


// lcGw: done_len=120, now left=1
// plcGw: total=121,  已处理：120
// plcGw: response READ ATTR-------------------------
// read_attr_num=23, totalFrame=1
// plcGw: {"head":{"gatewayId":"gw_1C3283005078","replaceId":"gw_1731656838724","msgId":0,"timeStamp":1731658312,"response":"readAttr"},
// "data":{"nodeType":1,"channel":2,"privAddr":1,"mac":"FFFFFFFFFFFF","name":"oilLevel_2_1","pid":"4001","totalFrame":1,"currFrame":1,"totalAttr":23,"itemCnt":23},
// "attrLst":[{"name":"olH","lable":"液位高","val":115},{"name":"olL","lable":"液位低","val":12429},
// {"name":"tempe","lable":"温度1","val":442},{"name":"alarmEn","lable":"液位报警使能","val":0},
// {"name":"thOlL","lable":"液位过低阈值","val":10000},{"name":"thOlH","lable":"液位过高阈值","val":60000},
// {"name":"thTL","lable":"温度过低阈值","val":0},{"name":"thTH","lable":"温度过高阈值","val":0},
// {"name":"verSw","lable":"软件版本","val":"12345","str":"1234","type":3},{"name":"verHw","lable":"硬件版本","val":"999888777666555","str":"1234","type":3},
// {"name":"productModel","lable":"产品型号","val":"","str":"1234","type":3},{"name":"productMsg","lable":"生产信息","val":"","str":"1234","type":3},
// {"name":"verdorMsg","lable":"厂家信息","val":"","str":"1234","type":3},{"name":"t","lable":"温度计算值","val":27.625},
// {"name":"rptT","lable":"温度上报值","val":28},{"name":"ol","lable":"液位计算值","val":115.01242828369141},
// {"name":"rptOl","lable":"液位上报值","val":11501},{"name":"almTL","lable":"低温报警","val":0},{"name":"almTH","lable":"高温报警","val":1},
// {"name":"almOlL","lable":"液位低报警","val":0},{"name":"almOlH","lable":"液位高报警","val":0},{"name":"alarmStatus","lable":"液位计报警信息","val":8},
// {"name":"test","lable":"test","val":0}]}


// {"head":{"gatewayId":"gw_CC0500CFB180","msgId":421,"timeStamp":0,"cmd":"readAttr"},"data":{"privAddr":85,"channel":1,"nodeType":1,"mask":"01","classMask":"11"}}
// iotv30  socket send done
// 15:48:08- ETH_1 local_ktj_js Rx: len=284   ----------------------离线的应答------
// {"head":{"gatewayId":"gw_CC0500CFB180","replaceId":"","msgId":421,"timeStamp":1737618488,"response":"readAttr"},"data":
// {"nodeType":1,"channel":1,"privAddr":85,"mac":"FFFFFFFFFFFF","name":"airCond_1_1","pid":"4011",
// "totalFrame":1,"currFrame":1,"totalAttr":0},"attrLst":[],"errCode":2}



#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include "dev_DIDO.h"
#include "dev_ac_meter.h"
#include "dev_air_cond.h"
#include "dev_battery.h"
#include "dev_dc_meter.h"
#include "dev_liquid_level.h"
#include "dev_manager.h"
#include "dev_smoke.h"
#include "dev_temper.h"
#include "dev_water.h"
#include "dev_generator.h"

#include "gui_cjson_api.h"
#include "iot_node.h"
#include "iot_node_func.h"
#include "iotv30_config.h"
#include "meter.h"
#include "print_log.h"  


#include "cJSON.h"
#include "gui_logist.h"

#include "proto_plat.h"
#include "string_tools.h"
#include "gw_ktj_tcp_client.h"
#include "device_data_struct.h"


#include "tcp_api_01.h" 
//#include "iotv30_tcp_client.h" 

//#include "gui_cjson_api.h"
#include "cjson_api_back.h"


// 3.12  读属性  readAttr
// 可以读单个设备属性，也可以读群组属性。群组属性应答是分别包含全部群组内设备的属性。因群组设备属性可能被单独修改过。
// 3.12.1读单个设备属性 （协议版本ver=1）


//3.12  读属性  readAttr  接收应答解析

void json_readback_readAttr_single(const char *pstr, const void *param)
{
	cJSON *json = NULL;
//	cJSON *json_head = NULL;
	cJSON *json_item = NULL;
	cJSON *json_data = NULL;

	cJSON *json_data_array = NULL;
	cJSON *json_item_array = NULL;
	cJSON *json_item_value = NULL;


    dev_mod_info_t   dev_mod_info;

    uint8_t idx;
    uint8_t total_attr=0,curr_frame=0;  //int 与0比较有问题
    uint8_t offline_flag=0;  //离线标记

    int32_t err_code; //


 #define   DEV_NAME_STR_LEN      (32u)   
    char dev_name_str[DEV_NAME_STR_LEN];

    int   json_data_array_size = 0, i = 0;

   // float ft;
	//unsigned int msg_id = 0;

    log_debug("%s() start\n",__FUNCTION__);

	json = cJSON_Parse(pstr);
	if (json == NULL) { // not json string
		return ;
	}


// plcGw: {"head":{"gatewayId":"gw_1C3283005078","replaceId":"gw_1731656838724","msgId":0,"timeStamp":1731658312,"response":"readAttr"},
// "data":{"nodeType":1,"channel":2,"privAddr":1,"mac":"FFFFFFFFFFFF","name":"oilLevel_2_1","pid":"4001","totalFrame":1,"currFrame":1,"totalAttr":23,"itemCnt":23},
// "data":{"nodeType":1,"channel":2,"privAddr":1,"mac":"FFFFFFFFFFFF","name":"oilLevel_2_1","pid":"4001","totalFrame":2,"currFrame":1,"totalAttr":52,"itemCnt":40},

// {"head":{"gatewayId":"gw_0000C0A8011B","replaceId":"","msgId":28,"timeStamp":1747640755,"response":"readAttr"},
// "data":{"nodeType":1,"channel":1,"privAddr":7,"mac":"FFFFFFFFFFFF","name":"sensor_ch1_addr7","pid":"d004","totalFrame":1,"currFrame":1,"totalAttr":13,"itemCnt":13},
// "attrLst":[{"name":"do1","dpid":16,"val":0,"type":0},{"name":"do2","dpid":17,"val":0,"type":0},{"name":"do3","dpid":18,"val":0,"type":0},
// {"name":"do4","dpid":19,"val":0,"type":0},{"name":"di1","dpid":64,"val":0,"type":0},{"name":"di2","dpid":65,"val":0,"type":0},
// {"name":"di3","dpid":66,"val":0,"type":0},{"name":"di4","dpid":67,"val":1,"type":0},{"name":"almEn","dpid":1349,"val":15,"type":0},
// {"name":"almCond","dpid":1350,"val":13,"type":0},{"name":"di","dpid":1345,"val":8,"type":0},{"name":"do","dpid":1344,"val":0,"type":0},
// {"name":"almStatus","dpid":1351,"val":10,"type":0}]}



// {"head":{"gatewayId":"gw_0000C0A8011B","replaceId":"","msgId":3924,"timeStamp":1747895183,"response":"readAttr"},
// "data":{"nodeType":1,"channel":1,"privAddr":17,"mac":"FFFFFFFFFFFF","name":"sensor_ch1_addr17","pid":"d003","totalFrame":1,"currFrame":1,"totalAttr":6,"itemCnt":6},
// "attrLst":[{"name":"volt1","dpid":43521,"val":10694,"type":0},{"name":"res1","dpid":43900,"val":3000,"type":0},
// {"name":"battHealth11a","dpid":44300,"val":0,"type":0},{"name":"temp1","dpid":44700,"val":259,"type":0},
// {"name":"remainCap1n2a","dpid":45100,"val":0,"type":0},{"name":"firstCap1n2a","dpid":45300,"val":0,"type":0}]}

// {"head":{"gatewayId":"gw_0000C0A8011B","replaceId":"","msgId":44,"timeStamp":1747879620,"response":"readAttr"},
// "data":{"nodeType":1,"channel":1,"privAddr":17,"mac":"FFFFFFFFFFFF","name":"sensor_ch1_addr17","pid":"d003"},
// "attrLst":[{"dpid":43521,"val":10694,"type":0},{"dpid":43900,"val":3000,"type":0},{"dpid":44300,"val":0,"type":0},
// {"dpid":44700,"val":259,"type":0},{"dpid":45100,"val":0,"type":0},{"dpid":45300,"val":0,"type":0}]}


	//msg_id = get_input_msgId(json);

	json_data = cJSON_GetObjectItem(json, "data");

	if(json_data) {
        
		json_item = cJSON_GetObjectItem(json_data, "currFrame" );
		if(json_item) {
            curr_frame =   cJSON_GetNumberValue(json_item);                                       
            log_debug("currFrame=%d\n", curr_frame);

		}

		json_item = cJSON_GetObjectItem(json_data, "totalAttr" );
		if(json_item) {
            total_attr =   cJSON_GetNumberValue(json_item);                                       
            log_debug("totalAttr=%d\n", total_attr);

		}

		json_item = cJSON_GetObjectItem(json_data, "channel" );
		if(json_item) {
            dev_mod_info.channel =   cJSON_GetNumberValue(json_item);                                       
            log_debug("channel=%d\n", dev_mod_info.channel );

		}

		json_item = cJSON_GetObjectItem(json_data, "privAddr" );
		if(json_item) {
            dev_mod_info.chan_addr =   cJSON_GetNumberValue(json_item);                                       
            log_debug("chan_addr=%d\n", dev_mod_info.chan_addr );
		}

		json_item = cJSON_GetObjectItem(json_data, "nodeType" );
		if(json_item) {
            dev_mod_info.node_type =   cJSON_GetNumberValue(json_item);                                       
            log_debug("node_type=%d\n", dev_mod_info.node_type );
		}

		json_item = cJSON_GetObjectItem(json_data, "name" );
		if(json_item) {
            log_debug("dev_name=%s\n", cJSON_GetStringValue(json_item) );      
              memset(dev_name_str,0,sizeof(dev_name_str) );
              strncpy(dev_name_str,json_item->valuestring,sizeof(dev_name_str) );//          
		}


		json_item = cJSON_GetObjectItem(json_data, "pid" );
		if(json_item) {
              log_debug("pid=%s\n", cJSON_GetStringValue(json_item) );      
             // memset(gui_gw_param.nv_gw_msg.wifiMac,0,sizeof(gui_gw_param.nv_gw_msg.wifiMac) );
             // strncpy(gui_gw_param.nv_gw_msg.wifiMac,json_item->valuestring,sizeof(gui_gw_param.nv_gw_msg.wifiMac) );
		}
	
	}



    if( 1u != curr_frame )
    {  //非首帧数据
        log_debug("curr_frame =%d, exit\n", curr_frame );     /////这里也还需要处理
        //goto lable_end;
    }


    // dev_mod_info.node_type  = IOT_SENSOR_liquid; //车工的节点类型为1.与物模型对应不上---这里手动更改为 IOT_SENSOR_liquid

//返回 0=查找失败， !0= 查找成功
    if( iot_find_node_index_with_info( &dev_mod_info, &idx ) ) 
    {
       dev_mod_info.node_type = iot_get_node_type_with_index(idx);
       iot_set_device_name_with_index( idx, dev_name_str); //保存设备名字
    }else{
        log_debug("channel=%d, chan_addr=%d, not found\n", dev_mod_info.channel, dev_mod_info.chan_addr );   
        goto lable_end;        
    }


// Tcp_ch1_TxData copy done------------节点不在线----------------------------
// 18:00:47- ETH_1 local_ktj_js Rx: len=283
// {"head":{"gatewayId":"gw_1C3283005078","replaceId":"","msgId":30,"timeStamp":1732442447,"response":"readAttr"},
// "data":{"nodeType":1,"channel":2,"privAddr":1,"mac":"FFFFFFFFFFFF","name":"oilLevel_2_1","pid":"4001","totalFrame":1,"currFrame":1,"totalAttr":0},
// "attrLst":[],"errCode":2}


    
        // "attrLst":[],"errCode":2}

        json_data_array = cJSON_GetObjectItem(json, "attrLst");    

        if( NULL==json_data_array)
        {
            log_debug("attrLst not found!\n");      
            goto lable_end;      
        }


        json_data_array_size = cJSON_GetArraySize(json_data_array);    /////这部分应该放到公共位置
        log_debug("json_data_array_size=%d\n",json_data_array_size);  ////json_data_array_size=0

        if( 0==json_data_array_size )
        {
            //"errCode":2}///??????
            // json_item = cJSON_GetObjectItem(json, "errCode"); 
            // json_item_value = cJSON_GetObjectItem(json_item_array, "errCode" );////
            // pattr_obj->flags.bit.online = 0;  //--节点离线了-----
            offline_flag = 1;
            
            //-----同步节点数据到 白名单--------
            iot_set_device_online_state_with_index(idx, 0); //pattr_obj->flags.bit.online 
            //----------同步节点在线标志到 白名单-----
        }


        ////"errCode":2}

		json_item = cJSON_GetObjectItem(json_data, "errCode" );
		if(json_item) {
            err_code =   cJSON_GetNumberValue(json_item);                                       
            log_debug("errCode=%d\n", err_code);

            if( 2 == err_code )
            {
                offline_flag = 1;//--节点离线了-----
                //-----同步节点数据到 白名单--------
                iot_set_device_online_state_with_index(idx, 0); //pattr_obj->flags.bit.online 
                //----------同步节点在线标志到 白名单-----               
            }
		}


    log_debug("node offline_flag=%d\n",offline_flag );


    switch( dev_mod_info.node_type )
    { //根据节点类型判断---对应的数据结构

       case IOT_SENSOR_liquid:
       {
            ///------如果不在线--返回什么数据????------------
            // "attrLst":[{"name":"olH","lable":"液位高","val":115},{"name":"olL","lable":"液位低","val":12429},
            // {"name":"tempe","lable":"温度1","val":442},{"name":"alarmEn","lable":"液位报警使能","val":0},
            // {"name":"thOlL","lable":"液位过低阈值","val":10000},{"name":"thOlH","lable":"液位过高阈值","val":60000},
            // {"name":"thTL","lable":"温度过低阈值","val":0},{"name":"thTH","lable":"温度过高阈值","val":0},
            // {"name":"verSw","lable":"软件版本","val":"12345","str":"1234","type":3},{"name":"verHw","lable":"硬件版本","val":"999888777666555","str":"1234","type":3},
            // {"name":"productModel","lable":"产品型号","val":"","str":"1234","type":3},{"name":"productMsg","lable":"生产信息","val":"","str":"1234","type":3},
            // {"name":"verdorMsg","lable":"厂家信息","val":"","str":"1234","type":3},{"name":"t","lable":"温度计算值","val":27.625},
            // {"name":"rptT","lable":"温度上报值","val":28},{"name":"ol","lable":"液位计算值","val":115.01242828369141},
            // {"name":"rptOl","lable":"液位上报值","val":11501},{"name":"almTL","lable":"低温报警","val":0},{"name":"almTH","lable":"高温报警","val":1},
            // {"name":"almOlL","lable":"液位低报警","val":0},{"name":"almOlH","lable":"液位高报警","val":0},{"name":"alarmStatus","lable":"液位计报警信息","val":8},
            // {"name":"test","lable":"test","val":0}]}  

                liquid_attr_t*   pattr_obj=NULL; 

                pattr_obj = liquid_get_obj( idx) ; 

                if( NULL==pattr_obj)
                {
                    log_debug("pattr_obj not found!\n");      
                    goto lable_end;        
                }else{    
                    log_debug("pattr_obj get ok!\n");    
                }
            
            
                    if( offline_flag )
                    {
                       //"errCode":2}///??????
                       // json_item = cJSON_GetObjectItem(json, "errCode"); 
                       // json_item_value = cJSON_GetObjectItem(json_item_array, "errCode" );////
                        pattr_obj->flags.bit.online = 0;  //--节点离线了-----
                        log_debug("node offline\n" );
                        goto lable_end;   
                    }

                    ////-------保存设备名-----
                    // memset(pattr_obj->dev_name_str,0,sizeof(pattr_obj->dev_name_str) );
                    // strncpy(pattr_obj->dev_name_str,dev_name_str,sizeof(pattr_obj->dev_name_str) );//        


                        for(i = 0; i < json_data_array_size; i++)
                        {
                            json_item_array = cJSON_GetArrayItem(json_data_array, i);

                            if( json_item_array ) 
                            {

                            json_item = cJSON_GetObjectItem(json_item_array, "name" );

                                if(json_item) 
                                {

                                    //log_debug("attr_name=%s\n", cJSON_GetStringValue(json_item) );      
                                    //log_debug("lable=%s\n", cJSON_GetStringValue(cJSON_GetObjectItem(json_item_array, "lable" )) );

            /*---------------------------------------------------

            // ,{"name":"t","lable":"温度计算值","val":27.625},
                                    if(  0== strcmp("t", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等

                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                        if(json_item_value) {
                                            liquid_obj->flags.bit.online = 1;  //节点在线标志
                                            //liquid_obj->data.temper  = cJSON_GetNumberValue(json_item_value);
                                            liquid_obj->data.temper  = cJSON_GetNumberValue(json_item_value) *100.0;   // 精确到0.01℃--测试ok
                                            log_debug("temper=%d\n", liquid_obj->data.temper );

                                            }

                                    }
                                            

            // {"name":"ol","lable":"液位计算值","val":115.01242828369141},
                                    if(  0== strcmp("ol", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等

                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                        if(json_item_value) {

                                            pattr_obj->data.level_mm  = cJSON_GetNumberValue(json_item_value) *100.0;   //0.01  
                                            // pattr_obj->data.level_mm  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                            pattr_obj->flags.bit.online = 1;  //节点在线标志
                                            log_debug("level_mm=%d\n", pattr_obj->data.level_mm );

                                            }

                                    }

            --------------------------------------------------*/


            // rptOl
            // rptT
// {"name":"t","lable":"温度计算值","class":17,"dpid":32772,"val":18.625},
// {"name":"rptT","lable":"温度上报值","class":16,"dpid":48,"val":1863},

                                    if(  0== strcmp("rptT", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等

                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                        if(json_item_value) {
                                            pattr_obj->flags.bit.online = 1;  //节点在线标志
                                            pattr_obj->data.temper  = cJSON_GetNumberValue(json_item_value);
                                            //  pattr_obj->data.temper  = cJSON_GetNumberValue(json_item_value) *100.0;   // 精确到0.01℃--测试ok
#if IOT_SENSOR_liquid_log_enable                                             
                                            log_debug("temper=%d\n", pattr_obj->data.temper );
#endif

                                        }

                                    }


                                    if(  0== strcmp("rptOl", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等
                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                        if(json_item_value) {
                                           // pattr_obj->data.level_mm  = cJSON_GetNumberValue(json_item_value) *100.0;   //0.01  
                                            pattr_obj->data.level_mm  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                            pattr_obj->flags.bit.online = 1;  //节点在线标志
#if IOT_SENSOR_liquid_log_enable                                             
                                            log_debug("level_mm=%d\n", pattr_obj->data.level_mm );
#endif                                        
                                        }

                                    }


            //{"name":"alarmStatus","lable":"液位计报警信息","val":8},

                                    if(  0== strcmp("alarmStatus", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等

                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                        if(json_item_value) {
                                            pattr_obj->data.alarm.value  = cJSON_GetNumberValue(json_item_value);
                                                pattr_obj->flags.bit.online = 1;  //节点在线标志
#if IOT_SENSOR_liquid_log_enable                                                 
                                            log_debug("alarmStatus=%d\n", pattr_obj->data.alarm.value );
#endif

                                            }

                                    }



                                //-----同步节点数据到 白名单--------
                                iot_set_device_online_state_with_index(idx,  pattr_obj->flags.bit.online ); 
                                ///----------同步节点在线标志到 白名单-----


            // {"name":"alarmEn","lable":"液位报警使能","val":0},

                                    if(  0== strcmp("alarmEn", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等

                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                        if(json_item_value) {
                                            pattr_obj->config.alarm_enable.value  = cJSON_GetNumberValue(json_item_value);
#if IOT_SENSOR_liquid_log_enable                                             
                                            log_debug("alarmEn=%d\n", pattr_obj->config.alarm_enable.value );
#endif

                                            }

                                    }


            // {"name":"thOlL","lable":"液位过低阈值","val":10000}
                                    if(  0== strcmp("thOlL", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等

                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                        if(json_item_value) {
                                            pattr_obj->config.under_level_th  = cJSON_GetNumberValue(json_item_value);
#if IOT_SENSOR_liquid_log_enable                                             
                                            log_debug("under_level_th=%d\n", pattr_obj->config.under_level_th );
#endif

                                            }
                                    }

            //{"name":"thOlH","lable":"液位过高阈值","val":60000},
                                    if(  0== strcmp("thOlH", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等

                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                        if(json_item_value) {
                                            pattr_obj->config.over_level_th  = cJSON_GetNumberValue(json_item_value);
#if IOT_SENSOR_liquid_log_enable                                             
                                            log_debug("over_level_th=%d\n", pattr_obj->config.over_level_th );
#endif

                                            }
                                    }




            // {"name":"thTL","lable":"温度过低阈值","val":0}

                                    if(  0== strcmp("thTL", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等

                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                        if(json_item_value) {
                                            pattr_obj->config.under_temper_th  = cJSON_GetNumberValue(json_item_value);//读回来的与写进去的一样
                                            //  pattr_obj->config.under_temper_th  = cJSON_GetNumberValue(json_item_value) *100.0;   //0.01  

#if IOT_SENSOR_liquid_log_enable                                             
                                            log_debug("under_temper_th=%d\n", pattr_obj->config.under_temper_th );
#endif

                                            }

                                    }


            // {"name":"thTH","lable":"温度过高阈值","val":0},

                                    if(  0== strcmp("thTH", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等

                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                        if(json_item_value) {
                                            pattr_obj->config.over_temper_th  = cJSON_GetNumberValue(json_item_value);//读回来的与写进去的一样
                                            // pattr_obj->config.over_temper_th  = cJSON_GetNumberValue(json_item_value) *100.0;   //0.01  
#if IOT_SENSOR_liquid_log_enable                                             
                                            log_debug("over_temper_th=%d\n", pattr_obj->config.over_temper_th );
#endif

                                            }

                                    }




            // {"name":"oilChkInterval","lable":"油耗检查周期","class":4,"dpid":1160,"val":10},
            // {"name":"thOilConsume","lable":"油耗异常阈值","class":4,"dpid":1161,"val":20000},

                                    if(  0== strcmp("oilChkInterval", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等

                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                        if(json_item_value) {
                                            pattr_obj->config.monitor_sec_th  = cJSON_GetNumberValue(json_item_value);   
#if IOT_SENSOR_liquid_log_enable                                             
                                            log_debug("monitor_sec_th=%d\n", pattr_obj->config.monitor_sec_th );
#endif

                                            }

                                    }

                                    if(  0== strcmp("thOilConsume", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等

                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                        if(json_item_value) {
                                            pattr_obj->config.monitor_level_th  = cJSON_GetNumberValue(json_item_value);   
#if IOT_SENSOR_liquid_log_enable                                             
                                            log_debug("monitor_level_th=%d\n", pattr_obj->config.monitor_level_th );
#endif

                                            }

                                    }



            // {"name":"verSw","lable":"软件版本","val":"12345","str":"1234","type":3},
            //{"name":"verHw","lable":"硬件版本","val":"999888777666555","str":"1234","type":3},
                                    if(  0== strcmp("verSw", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等

                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                        if(json_item_value) {

                                            memset(pattr_obj->info.soft_ver,0,sizeof(pattr_obj->info.soft_ver) );
                                            strncpy(pattr_obj->info.soft_ver,json_item->valuestring,sizeof(pattr_obj->info.soft_ver) );  //cJSON_GetStringValue(json_item_value)
                                            
                                            log_debug("soft_ver=%s\n", pattr_obj->info.soft_ver );
                                            }
                                    }


            // {"name":"productModel","lable":"产品型号","val":"","str":"1234","type":3},
                                    if(  0== strcmp("productModel", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等

                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                        if(json_item_value) {

                                            memset(pattr_obj->info.product_model,0,sizeof(pattr_obj->info.product_model) );
                                            strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.product_model) );  
                                            
                                            log_debug("productModel=%s\n", pattr_obj->info.product_model );
                                            }
                                    }



            //{"name":"productMsg","lable":"生产信息","val":"","str":"1234","type":3},

                                    if(  0== strcmp("productMsg", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等

                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                        if(json_item_value) {

                                            memset(pattr_obj->info.production_info,0,sizeof(pattr_obj->info.production_info) );
                                            strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.production_info) );  
                                            
                                            log_debug("production_info=%s\n", pattr_obj->info.production_info );
                                            }
                                    }


            // {"name":"verdorMsg","lable":"厂家信息","val":"","str":"1234","type":3},
                                    if(  0== strcmp("verdorMsg", cJSON_GetStringValue(json_item) ) )
                                    {//为0表示相等

                                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                        if(json_item_value) {

                                            memset(pattr_obj->info.manufacturer,0,sizeof(pattr_obj->info.manufacturer) );
                                            strncpy(pattr_obj->info.manufacturer,json_item->valuestring,sizeof(pattr_obj->info.manufacturer) );  
                                            
                                            log_debug("manufacturer=%s\n", pattr_obj->info.manufacturer );
                                            }
                                    }


                                }  ///-----if(json_item)   

                            }  // ---- if( json_item_array ) 
            
                        }  //---for---json_data_array_size

       } break;



       case IOT_SENSOR_smoke:
       {

                smoke_attr_t*   pattr_obj=NULL; 

                pattr_obj = smoke_get_obj( idx) ; 

                if( NULL==pattr_obj)
                {
                    log_debug("pattr_obj not found!\n");      
                    goto lable_end;        
                }else{    
                    log_debug("pattr_obj get ok!\n");    
                }
            
                     if( offline_flag )
                    {
                       //"errCode":2}///??????
                       // json_item = cJSON_GetObjectItem(json, "errCode"); 
                       // json_item_value = cJSON_GetObjectItem(json_item_array, "errCode" );////
                        pattr_obj->flags.bit.online = 0;  //--节点离线了-----
                        log_debug("node offline\n" );
                        goto lable_end;   
                    }

                    ////-------保存设备名-----
                    // memset(pattr_obj->dev_name_str,0,sizeof(pattr_obj->dev_name_str) );
                    // strncpy(pattr_obj->dev_name_str,dev_name_str,sizeof(pattr_obj->dev_name_str) );//        


                    for(i = 0; i < json_data_array_size; i++)
                    {
                        json_item_array = cJSON_GetArrayItem(json_data_array, i);

                        if( json_item_array ) 
                        {

                        json_item = cJSON_GetObjectItem(json_item_array, "name" );

                            if(json_item) 
                            {


// 0x0010,status,状态,0,3,0,uint16,3,12,0,1,1,0,0,0x13,0x19
// 0x0011,almDelay,报警延时,0,3,6,uint16,0x33,12,0,1,1,0,0,0x13,0x19
//0x0520	almStatusSmoke	烟雾报警信息
// 0x0620	alarmEn	烟雾报警使能
// 0x0621	almDelay	报警延时时间



                                if(  0== strcmp("almStatusSmoke", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.alarm.value  = cJSON_GetNumberValue(json_item_value);   
#if IOT_SENSOR_smoke_log_enable                                                                        
                                        log_debug("smoke alarm=%d\n", pattr_obj->data.alarm.value );
#endif

                                        }

                                }




                                //-----同步节点数据到 白名单--------
                                iot_set_device_online_state_with_index(idx,  pattr_obj->flags.bit.online ); 
                                ///----------同步节点在线标志到 白名单-----



                                if(  0== strcmp("almDelay", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        pattr_obj->config.alarm_delay_sec  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
#if IOT_SENSOR_smoke_log_enable                                        
                                        log_debug("alarm_delay_sec=%d\n", pattr_obj->config.alarm_delay_sec );
#endif

                                        }
                                }

  
                                if(  0== strcmp("alarmEn", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        pattr_obj->config.alarm_enable.value  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
#if IOT_SENSOR_smoke_log_enable                                        
                                        log_debug("alarm_enable =%x\n", pattr_obj->config.alarm_enable.value );
#endif

                                        }

                                }
                              


        // {"name":"verSw","lable":"软件版本","val":"12345","str":"1234","type":3},
        //{"name":"verHw","lable":"硬件版本","val":"999888777666555","str":"1234","type":3},
                                if(  0== strcmp("verSw", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.soft_ver,0,sizeof(pattr_obj->info.soft_ver) );
                                        strncpy(pattr_obj->info.soft_ver,json_item->valuestring,sizeof(pattr_obj->info.soft_ver) );  //cJSON_GetStringValue(json_item_value)
                                        
                                        log_debug("soft_ver=%s\n", pattr_obj->info.soft_ver );
                                        }
                                }


        // {"name":"productModel","lable":"产品型号","val":"","str":"1234","type":3},
                                if(  0== strcmp("productModel", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.product_model,0,sizeof(pattr_obj->info.product_model) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.product_model) );  
                                        
                                        log_debug("productModel=%s\n", pattr_obj->info.product_model );
                                        }
                                }



        //{"name":"productMsg","lable":"生产信息","val":"","str":"1234","type":3},

                                if(  0== strcmp("productMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.production_info,0,sizeof(pattr_obj->info.production_info) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.production_info) );  
                                        
                                        log_debug("production_info=%s\n", pattr_obj->info.production_info );
                                        }
                                }


        // {"name":"verdorMsg","lable":"厂家信息","val":"","str":"1234","type":3},
                                if(  0== strcmp("verdorMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.manufacturer,0,sizeof(pattr_obj->info.manufacturer) );
                                        strncpy(pattr_obj->info.manufacturer,json_item->valuestring,sizeof(pattr_obj->info.manufacturer) );  
                                        
                                        log_debug("manufacturer=%s\n", pattr_obj->info.manufacturer );
                                        }
                                }


                            }  ///-----if(json_item)   

                        }  // ---- if( json_item_array ) 
        
                    }  //---for---json_data_array_size

       } break ;




       case IOT_SENSOR_water:
       {

                dev_water_attr_t*   pattr_obj=NULL; 
                pattr_obj = dev_water_get_obj( idx) ; 

                if( NULL==pattr_obj)
                {
                    log_debug("pattr_obj not found!\n");      
                    goto lable_end;        
                }else{    
                    log_debug("pattr_obj get ok!\n");    
                }
            
            
                    if( offline_flag )
                    {
                       //"errCode":2}///??????
                        pattr_obj->flags.bit.online = 0;  //--节点离线了-----
                        log_debug("node offline\n" );
                        goto lable_end;   
                    }
                    ////-------保存设备名-----
                    // memset(pattr_obj->dev_name_str,0,sizeof(pattr_obj->dev_name_str) );
                    // strncpy(pattr_obj->dev_name_str,dev_name_str,sizeof(pattr_obj->dev_name_str) );//        


                    for(i = 0; i < json_data_array_size; i++)
                    {
                        json_item_array = cJSON_GetArrayItem(json_data_array, i);

                        if( json_item_array ) 
                        {

                        json_item = cJSON_GetObjectItem(json_item_array, "name" );

                            if(json_item) 
                            {

// 0x0530	almStatusLeak	水浸状态字
// 0x0531	posiIpd	位置阻抗
// 0x0532	detectIpd	检测阻抗
// 0x0533	detectCurr	检测电流
// 0x0534	RGIpd	RG阻抗
// 0x0535	YBIpd	YB阻抗
// 0x0536	leakPosi	泄露位置

                                if(  0== strcmp("almStatusLeak", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.status.value  = cJSON_GetNumberValue(json_item_value);   
#if IOT_SENSOR_dev_water_log_enable                                                                 
                                        log_debug("dev_water status=%x\n", pattr_obj->data.status.value );
#endif

                                        }

                                }

// 0x0536	leakPosi	泄露位置
                                if(  0== strcmp("leakPosi", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.position_01m  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_dev_water_log_enable                                                                
                                        log_debug("dev_water position_01m=%d\n", pattr_obj->data.position_01m );
#endif

                                        }

                                }



                                if(  0== strcmp("posiIpd", cJSON_GetStringValue(json_item) ) )
                                {//位置阻抗

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.position_ohm  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_dev_water_log_enable                                                                
                                        log_debug("dev_water position_ohm=%d\n", pattr_obj->data.position_ohm );
#endif

                                        }

                                }

// 0x0532	detectIpd	检测阻抗
                                if(  0== strcmp("detectIpd", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.R_khom  = cJSON_GetNumberValue(json_item_value); 
#if IOT_SENSOR_dev_water_log_enable                                                                   
                                        log_debug("dev_water R_khom=%d\n", pattr_obj->data.R_khom );
#endif

                                        }

                                }


//   dev_water_alarm_u  status;     // 0x0530	水浸状态字	RO
//   uint16_t   position_ohm;       // Ω 0x0531	位置阻抗	RO   impedance
//   uint16_t   R_khom;             // KΩ 0x0532	检测阻抗	RO   impedance
//   uint16_t   current;            // 0.1μA  0x0533	检测电流	RO
//   uint16_t   RG_ohm;             // Ω 0x0534	RG阻抗	   RO
//   uint16_t   YB_ohm;             // Ω 0x0535	YB阻抗	   RO
//   uint16_t   position_01m;       // 0.1m  0x0536	泄露位置	RO	

// 0x0533	detectCurr	检测电流

                                if(  0== strcmp("detectCurr", cJSON_GetStringValue(json_item) ) )
                                {

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.current  = cJSON_GetNumberValue(json_item_value);  
#if IOT_SENSOR_dev_water_log_enable                                                                  
                                        log_debug("dev_water current=%d\n", pattr_obj->data.current );
#endif

                                        }

                                }

// 0x0534	RGIpd	RG阻抗

                                if(  0== strcmp("RGIpd", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.RG_ohm  = cJSON_GetNumberValue(json_item_value);   
#if IOT_SENSOR_dev_water_log_enable                                                                 
                                        log_debug("dev_water RG_ohm=%d\n", pattr_obj->data.RG_ohm );
#endif

                                        }

                                }
// 0x0535	YBIpd	YB阻抗
                                if(  0== strcmp("YBIpd", cJSON_GetStringValue(json_item) ) )
                                {

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.YB_ohm  = cJSON_GetNumberValue(json_item_value);          
#if IOT_SENSOR_dev_water_log_enable                                                          
                                        log_debug("dev_water YB_ohm=%d\n", pattr_obj->data.YB_ohm );
#endif

                                        }

                                }



                                //-----同步节点数据到 白名单--------
                                iot_set_device_online_state_with_index(idx,  pattr_obj->flags.bit.online ); 
                                ///----------同步节点在线标志到 白名单-----



// 0x0630	alarmEn	水浸报警使能
// 0x0631	simMode	sim工作方式
// 0x0632	thLeakIpd	泄露阻抗阈值
// 0x0633	thCurr	工作电流阈值
// 0x0634	thSensor	传感增量阈值
// 0x0635	resRate	电阻率

                                if(  0== strcmp("alarmEn", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.alarm_enable.value  = cJSON_GetNumberValue(json_item_value);   //0.01  
#if IOT_SENSOR_dev_water_log_enable                                 
                                        log_debug("dev_water alarm_enable=%x\n", pattr_obj->config.alarm_enable.value );
                                    #endif
                                    }
                                }


                                if(  0== strcmp("simMode", cJSON_GetStringValue(json_item) ) )
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.mode  = cJSON_GetNumberValue(json_item_value);   //0.01  
#if IOT_SENSOR_dev_water_log_enable                                 
                                        log_debug("dev_water mode=%d\n", pattr_obj->config.mode );
                                    #endif
                                    }
                                }

                                if(  0== strcmp("thLeakIpd", cJSON_GetStringValue(json_item) ) )
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.leak_kohm_th  = cJSON_GetNumberValue(json_item_value);   //0.01  
#if IOT_SENSOR_dev_water_log_enable                                 
                                        log_debug("dev_water leak_kohm_th=%d\n", pattr_obj->config.leak_kohm_th );
                                    #endif
                                    }
                                }

                                if(  0== strcmp("thCurr", cJSON_GetStringValue(json_item) ) )
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.current_th  = cJSON_GetNumberValue(json_item_value);   //0.01  
#if IOT_SENSOR_dev_water_log_enable                                 
                                        log_debug("dev_water current_th=%d\n", pattr_obj->config.current_th );
                                    #endif
                                    }
                                }

                                if(  0== strcmp("thSensor", cJSON_GetStringValue(json_item) ) )
                                {// 0x0634	thSensor	传感增量阈值
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.inc_percent_th  = cJSON_GetNumberValue(json_item_value);   //0.01  
#if IOT_SENSOR_dev_water_log_enable                                 
                                        log_debug("dev_water inc_percent_th=%d\n", pattr_obj->config.inc_percent_th );
                                    #endif
                                    }
                                }
                                if(  0== strcmp("resRate", cJSON_GetStringValue(json_item) ) )
                                {// 0x0635	resRate	电阻率
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.wire_ohm_m  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        
#if IOT_SENSOR_dev_water_log_enable                            
                                        log_debug("dev_water wire_ohm_m=%d\n", pattr_obj->config.wire_ohm_m );
#endif


                                    }
                                }


 
                                if(  0== strcmp("verSw", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.soft_ver,0,sizeof(pattr_obj->info.soft_ver) );
                                        strncpy(pattr_obj->info.soft_ver,json_item->valuestring,sizeof(pattr_obj->info.soft_ver) );  //cJSON_GetStringValue(json_item_value)
                                        
                                        log_debug("soft_ver=%s\n", pattr_obj->info.soft_ver );
                                        }
                                }


        // {"name":"productModel","lable":"产品型号","val":"","str":"1234","type":3},
                                if(  0== strcmp("productModel", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.product_model,0,sizeof(pattr_obj->info.product_model) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.product_model) );  
                                        
                                        log_debug("productModel=%s\n", pattr_obj->info.product_model );
                                        }
                                }



        //{"name":"productMsg","lable":"生产信息","val":"","str":"1234","type":3},

                                if(  0== strcmp("productMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.production_info,0,sizeof(pattr_obj->info.production_info) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.production_info) );  
                                        
                                        log_debug("production_info=%s\n", pattr_obj->info.production_info );
                                        }
                                }


        // {"name":"verdorMsg","lable":"厂家信息","val":"","str":"1234","type":3},
                                if(  0== strcmp("verdorMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.manufacturer,0,sizeof(pattr_obj->info.manufacturer) );
                                        strncpy(pattr_obj->info.manufacturer,json_item->valuestring,sizeof(pattr_obj->info.manufacturer) );  
                                        
                                        log_debug("manufacturer=%s\n", pattr_obj->info.manufacturer );
                                        }
                                }


                            }  ///-----if(json_item)   

                        }  // ---- if( json_item_array ) 
        
                    }  //---for---json_data_array_size

       } break ;



       case IOT_SENSOR_temper_humidity:  //0xD000,//temperature and humidity 
       {

                temp_humi_attr_t*   pattr_obj=NULL; 

                pattr_obj = temp_humi_get_obj( idx) ; 

                if( NULL==pattr_obj)
                {
                    log_debug("pattr_obj not found!\n");      
                    goto lable_end;        
                }else{    
                    log_debug("pattr_obj get ok!\n");    
                }
            
                    if( offline_flag )
                    {
                       //"errCode":2}///??????
                        pattr_obj->flags.bit.online = 0;  //--节点离线了-----
                        log_debug("node offline\n" );
                        goto lable_end;   
                    }

                    ////-------保存设备名-----
                    // memset(pattr_obj->dev_name_str,0,sizeof(pattr_obj->dev_name_str) );
                    // strncpy(pattr_obj->dev_name_str,dev_name_str,sizeof(pattr_obj->dev_name_str) );//        


                    for(i = 0; i < json_data_array_size; i++)
                    {
                        json_item_array = cJSON_GetArrayItem(json_data_array, i);

                        if( json_item_array ) 
                        {

                        json_item = cJSON_GetObjectItem(json_item_array, "name" );

                            if(json_item) 
                            {


// t	温度计算值	duC
// rptT	温度上报值	duC
// h	湿度计算值	0
// rptH	湿度上报值	0.01mm

// 0x0510	almStatusTH	温湿度报警信息
// 0x0511	rptHum	湿度 ???

/*-----------------------------------------------------------------------------------------------
read_attr_num=18, uploadNum=14, totalFrame=1
{"head":{"gatewayId":"gw_1C3283005078","replaceId":"gw_1736220236415","msgId":0,"timeStamp":1736221305,"response":"readAttr"},
"data":{"nodeType":1,"channel":1,"privAddr":1,"mac":"FFFFFFFFFFFF","name":"tempe_1_3","pid":"4003","totalFrame":1,"currFrame":1,"totalAttr":14,"itemCnt":14},
"attrLst":[{"name":"tempe","lable":"温度读数","class":17,"dpid":16,"val":1988},
{"name":"rptT","lable":"温度上报值","class":17,"dpid":48,"val":20},
{"name":"hum","lable":"湿度读数","class":17,"dpid":17,"val":4501},
{"name":"h","lable":"湿度计算值","class":17,"dpid":32771,"val":4501},
{"name":"rptH","lable":"湿度上报值","class":17,"dpid":1281,"val":45},
{"name":"almTL","lable":"低温报警","class":17,"dpid":65280,"val":0},
{"name":"almTH","lable":"高温报警","class":17,"dpid":65281,"val":1},{"name":"almHumL","lable":"湿度低报警","class":17,"dpid":65282,"val":0},
{"name":"almHumH","lable":"湿度高报警","class":17,"dpid":65283,"val":1},{"name":"humFallAlm","lable":"湿度异常下降报警","class":17,"dpid":65294,"val":0},
{"name":"humRiseAlm","lable":"湿度异常上升报警","class":17,"dpid":65295,"val":0},{"name":"humDeltaAlm","lable":"湿度异常变化报警","class":17,"dpid":65296,"val":0},
{"name":"tempeRise","lable":"温度变化值","class":17,"dpid":65297,"val":20},{"name":"tempeFallAlm","lable":"温降异常报警","class":17,"dpid":65302,"val":0}]}
----------------------------------------------------------------------------------------------- */
						

                                if(  0== strcmp("almStatusTH", cJSON_GetStringValue(json_item) ) )////没有对应字段
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.alarm.value  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_temp_humi_log_enable                                
                                        log_debug("temp_humi alarm=%d\n", pattr_obj->data.alarm.value );
#endif

                                        }

                                }

                                if(  0== strcmp("rptT", cJSON_GetStringValue(json_item) ) )////单位不对
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.temper  = cJSON_GetNumberValue(json_item_value);         
#if IOT_SENSOR_temp_humi_log_enable                            
                                        log_debug("temp_humi temper=%d\n", pattr_obj->data.temper );
#endif

                                        }

                                }


                                if(  0== strcmp("rptH", cJSON_GetStringValue(json_item) ) ) //// 0x0511	rptHum	湿度 ???
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.humidity  = cJSON_GetNumberValue(json_item_value);            
#if IOT_SENSOR_temp_humi_log_enable                         
                                        log_debug("temp_humi humidity=%d\n", pattr_obj->data.humidity );
 #endif
                                       }
                                }


                                //-----同步节点数据到 白名单--------
                                iot_set_device_online_state_with_index(idx,  pattr_obj->flags.bit.online ); 
                                ///----------同步节点在线标志到 白名单-----

// 0x0610	alarmEn	温湿度报警使能
// 0x0611	thHL	湿度过低阈值
// 0x0612	thHH	湿度过高阈值
// 0x0613	tempeChkInterval	温度变化监测周期
// 0x0614	thTempeRise	温度变化异常值
// 0x0615	humChkInterval	湿度变化监测周期
// 0x0616	thHumChange	湿度变化异常值

                                if(  0== strcmp("alarmEn", cJSON_GetStringValue(json_item) ) ) 
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.alarm_enable.value  = cJSON_GetNumberValue(json_item_value);         
#if IOT_SENSOR_temp_humi_log_enable                            
                                        log_debug("temp_humi alarm_enable=%x\n", pattr_obj->config.alarm_enable.value  );
 #endif
                                       }
                                }


                                if(  0== strcmp("thHL", cJSON_GetStringValue(json_item) ) ) 
                                {// 0x0611	thHL	湿度过低阈值
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.under_humidity_th  = cJSON_GetNumberValue(json_item_value);              
#if IOT_SENSOR_temp_humi_log_enable                       
                                        log_debug("temp_humi under_humidity_th=%x\n", pattr_obj->config.under_humidity_th  );
 #endif
                                       }
                                }

                                if(  0== strcmp("thHH", cJSON_GetStringValue(json_item) ) ) 
                                {// 0x0612	thHH	湿度过高阈值
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.over_humidity_th  = cJSON_GetNumberValue(json_item_value);          
#if IOT_SENSOR_temp_humi_log_enable                           
                                        log_debug("temp_humi over_humidity_th=%x\n", pattr_obj->config.over_humidity_th  );
 #endif
                                       }
                                }

// thTL	温度过低阈值
// thTH	温度过高阈值
// thHL	湿度过低阈值
// thHH	湿度过高阈值


                                if(  0== strcmp("thTL", cJSON_GetStringValue(json_item) ) ) 
                                {//	温度过低阈值
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.under_temper_th  = cJSON_GetNumberValue(json_item_value);          
#if IOT_SENSOR_temp_humi_log_enable                           
                                        log_debug("temp_humi under_temper_th=%x\n", pattr_obj->config.under_temper_th  );
 #endif
                                       }
                                }

                                if(  0== strcmp("thTH", cJSON_GetStringValue(json_item) ) ) 
                                {// 温度过高阈值
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.over_temper_th  = cJSON_GetNumberValue(json_item_value);       
#if IOT_SENSOR_temp_humi_log_enable                              
                                        log_debug("temp_humi over_temper_th=%x\n", pattr_obj->config.over_temper_th  );
 #endif
                                       }
                                }


#if 0
                                if(  0== strcmp("tempeChkInterval", cJSON_GetStringValue(json_item) ) ) 
                                {//// 0x0613	tempeChkInterval	温度变化监测周期
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.temper_monitor_sec_th  = cJSON_GetNumberValue(json_item_value);                                   
                                        log_debug("temp_humi temper_monitor_sec_th=%x\n", pattr_obj->config.temper_monitor_sec_th  );
                                        }
                                }

                                if(  0== strcmp("thTempeRise", cJSON_GetStringValue(json_item) ) ) 
                                {//  0x0614	thTempeRise	温度变化异常值
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.temper_monitor_th  = cJSON_GetNumberValue(json_item_value);                                   
                                        log_debug("temp_humi temper_monitor_th=%x\n", pattr_obj->config.temper_monitor_th  );
                                        }
                                }



                                if(  0== strcmp("humChkInterval", cJSON_GetStringValue(json_item) ) ) 
                                {// 0x0615	humChkInterval	湿度变化监测周期
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.humidity_monitor_sec_th  = cJSON_GetNumberValue(json_item_value);                                   
                                        log_debug("temp_humi humidity_monitor_sec_th=%x\n", pattr_obj->config.humidity_monitor_sec_th  );
                                        }
                                }

                                if(  0== strcmp("thHumChange", cJSON_GetStringValue(json_item) ) ) 
                                {// 0x0616	thHumChange	湿度变化异常值
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.humidity_monitor_th  = cJSON_GetNumberValue(json_item_value);                                   
                                        log_debug("temp_humi humidity_monitor_th=%x\n", pattr_obj->config.humidity_monitor_th  );
                                        }
                                }
#endif

        // {"name":"verSw","lable":"软件版本","val":"12345","str":"1234","type":3},
        //{"name":"verHw","lable":"硬件版本","val":"999888777666555","str":"1234","type":3},
                                if(  0== strcmp("verSw", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.soft_ver,0,sizeof(pattr_obj->info.soft_ver) );
                                        strncpy(pattr_obj->info.soft_ver,json_item->valuestring,sizeof(pattr_obj->info.soft_ver) );  //cJSON_GetStringValue(json_item_value)
                                        
                                        log_debug("soft_ver=%s\n", pattr_obj->info.soft_ver );
                                        }
                                }


        // {"name":"productModel","lable":"产品型号","val":"","str":"1234","type":3},
                                if(  0== strcmp("productModel", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.product_model,0,sizeof(pattr_obj->info.product_model) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.product_model) );  
                                        
                                        log_debug("productModel=%s\n", pattr_obj->info.product_model );
                                        }
                                }



        //{"name":"productMsg","lable":"生产信息","val":"","str":"1234","type":3},

                                if(  0== strcmp("productMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.production_info,0,sizeof(pattr_obj->info.production_info) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.production_info) );  
                                        
                                        log_debug("production_info=%s\n", pattr_obj->info.production_info );
                                        }
                                }


        // {"name":"verdorMsg","lable":"厂家信息","val":"","str":"1234","type":3},
                                if(  0== strcmp("verdorMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.manufacturer,0,sizeof(pattr_obj->info.manufacturer) );
                                        strncpy(pattr_obj->info.manufacturer,json_item->valuestring,sizeof(pattr_obj->info.manufacturer) );  
                                        
                                        log_debug("manufacturer=%s\n", pattr_obj->info.manufacturer );
                                        }
                                }


                            }  ///-----if(json_item)   

                        }  // ---- if( json_item_array ) 
        
                    }  //---for---json_data_array_size

       } break ;


       case IOT_SENSOR_dido: //door 门禁传感器
       {

                dev_dido_attr_t*   pattr_obj=NULL; 

                pattr_obj = dev_dido_get_obj( idx) ; 

                if( NULL==pattr_obj)
                {
                    log_debug("pattr_obj not found!\n");      
                    goto lable_end;        
                }else{    
                    log_debug("pattr_obj get ok!\n");    
                }
            
                    if( offline_flag )
                    {
                       //"errCode":2}///??????
                        pattr_obj->flags.bit.online = 0;  //--节点离线了-----
                        log_debug("node offline\n" );
                        goto lable_end;   
                    }

                    ////-------保存设备名-----
                    // memset(pattr_obj->dev_name_str,0,sizeof(pattr_obj->dev_name_str) );
                    // strncpy(pattr_obj->dev_name_str,dev_name_str,sizeof(pattr_obj->dev_name_str) );//        


                    for(i = 0; i < json_data_array_size; i++)
                    {
                        json_item_array = cJSON_GetArrayItem(json_data_array, i);

                        if( json_item_array ) 
                        {

                        json_item = cJSON_GetObjectItem(json_item_array, "name" );

                            if(json_item) 
                            {
                                if(  0== strcmp("do1", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.do1  = cJSON_GetNumberValue(json_item_value);                                   
                                        log_debug("dev_dido do1=%x\n", pattr_obj->config.do1 );
#if IOT_SENSOR_dido_log_enable                                                                    
                                         log_debug("dev_dido do1=%x\n", pattr_obj->config.do1 );
#endif

                                    }
                                }

                                if(  0== strcmp("do2", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.do2  = cJSON_GetNumberValue(json_item_value);              
#if IOT_SENSOR_dido_log_enable                      
                                        log_debug("dev_dido do2=%x\n", pattr_obj->config.do2 );
#endif
                                    }
                                }



#if 0
                                if(  0== strcmp("do3", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.do3  = cJSON_GetNumberValue(json_item_value);       
#if IOT_SENSOR_dido_log_enable                             
                                        log_debug("dev_dido do3=%x\n", pattr_obj->config.do3 );
#endif
                                    }
                                }

                                if(  0== strcmp("do4", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.do4 = cJSON_GetNumberValue(json_item_value);      
#if IOT_SENSOR_dido_log_enable                              
                                        log_debug("dev_dido do4=%x\n", pattr_obj->config.do4 );
#endif
                                    }
                                }


#endif


// 0x0540	do	IO输出状态
// 0x0541	di	IO输入状态
// 0x0542	ioLock	IO锁存状态

                                if(  0== strcmp("di", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        pattr_obj->data.input.value  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
#if IOT_SENSOR_dido_log_enable                                        
                                        log_debug("dev_dido d1=%x\n", pattr_obj->data.input.value );
#endif

                                        }
                                }


#if dev_dido_ver0_enable
                                if(  0== strcmp("do", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.output.value  = cJSON_GetNumberValue(json_item_value);                                   
                                        log_debug("dev_dido do=%x\n", pattr_obj->data.output.value );
                                        }
                                }

                                if(  0== strcmp("ioLock", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        pattr_obj->data.latch.value  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        log_debug("dev_dido latch=%x\n", pattr_obj->data.latch.value );

                                        }

                                }

#endif
  

                            if(  0== strcmp("almEn", cJSON_GetStringValue(json_item) ) )
                            {//为0表示相等

                                json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                if(json_item_value) {

                                    pattr_obj->config.almEn.value  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                    pattr_obj->flags.bit.online = 1;  //节点在线标志
#if IOT_SENSOR_dido_log_enable                                      
                                    log_debug("dev_dido almEn=%x\n", pattr_obj->config.almEn.value );
#endif                                
                                }
                            }

                            if(  0== strcmp("almCond", cJSON_GetStringValue(json_item) ) )
                            {//为0表示相等

                                json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                if(json_item_value) {

                                    pattr_obj->config.almCond.value  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                    pattr_obj->flags.bit.online = 1;  //节点在线标志
#if IOT_SENSOR_dido_log_enable                                      
                                    log_debug("dev_dido almCond=%x\n", pattr_obj->config.almCond.value );
#endif                                
                                }
                            }

                            if(  0== strcmp("almStatus", cJSON_GetStringValue(json_item) ) )
                            {//为0表示相等

                                json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                if(json_item_value) {

                                    pattr_obj->config.almStatus.value  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                    pattr_obj->flags.bit.online = 1;  //节点在线标志
#if IOT_SENSOR_dido_log_enable                                      
                                    log_debug("dev_dido almStatus=%x\n", pattr_obj->config.almStatus.value );
#endif                                
                                }
                            }

                                //-----同步节点数据到 白名单--------
                                iot_set_device_online_state_with_index(idx,  pattr_obj->flags.bit.online ); 
                                ///----------同步节点在线标志到 白名单-----

                              


/*-------------------------------------- 
                                if(  0== strcmp("di", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        pattr_obj->config.output_enable.value  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        log_debug("dev_dido output_enable=%x\n", pattr_obj->config.output_enable.value );

                                        }

                                }

------------------------------------ */


        // {"name":"verSw","lable":"软件版本","val":"12345","str":"1234","type":3},
        //{"name":"verHw","lable":"硬件版本","val":"999888777666555","str":"1234","type":3},
                                if(  0== strcmp("verSw", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.soft_ver,0,sizeof(pattr_obj->info.soft_ver) );
                                        strncpy(pattr_obj->info.soft_ver,json_item->valuestring,sizeof(pattr_obj->info.soft_ver) );  //cJSON_GetStringValue(json_item_value)
                                        
                                        log_debug("soft_ver=%s\n", pattr_obj->info.soft_ver );
                                        }
                                }


        // {"name":"productModel","lable":"产品型号","val":"","str":"1234","type":3},
                                if(  0== strcmp("productModel", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.product_model,0,sizeof(pattr_obj->info.product_model) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.product_model) );  
                                        
                                        log_debug("productModel=%s\n", pattr_obj->info.product_model );
                                        }
                                }



        //{"name":"productMsg","lable":"生产信息","val":"","str":"1234","type":3},

                                if(  0== strcmp("productMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.production_info,0,sizeof(pattr_obj->info.production_info) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.production_info) );  
                                        
                                        log_debug("production_info=%s\n", pattr_obj->info.production_info );
                                        }
                                }


        // {"name":"verdorMsg","lable":"厂家信息","val":"","str":"1234","type":3},
                                if(  0== strcmp("verdorMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.manufacturer,0,sizeof(pattr_obj->info.manufacturer) );
                                        strncpy(pattr_obj->info.manufacturer,json_item->valuestring,sizeof(pattr_obj->info.manufacturer) );  
                                        
                                        log_debug("manufacturer=%s\n", pattr_obj->info.manufacturer );
                                        }
                                }


                            }  ///-----if(json_item)   

                        }  // ---- if( json_item_array ) 
        
                    }  //---for---json_data_array_size

       } break ;


//还需要识别节点掉线的情况
       case IOT_SENSOR_ac_meter:
       {
                ac_meter_attr_t*   pattr_obj=NULL; 

                pattr_obj = ac_meter_get_obj( idx) ; 

                if( NULL==pattr_obj)
                {
                    log_debug("pattr_obj not found!\n");      
                    goto lable_end;        
                }else{    
                    log_debug("pattr_obj get ok!\n");    
                }
            
            
                    if( offline_flag )
                    {
                       //"errCode":2}///??????
                        pattr_obj->flags.bit.online = 0;  //--节点离线了-----
                        log_debug("node offline\n" );
                        goto lable_end;   
                    }

                    ////-------保存设备名-----
                    // memset(pattr_obj->dev_name_str,0,sizeof(pattr_obj->dev_name_str) );
                    // strncpy(pattr_obj->dev_name_str,dev_name_str,sizeof(pattr_obj->dev_name_str) );//        


                    for(i = 0; i < json_data_array_size; i++)
                    {
                        json_item_array = cJSON_GetArrayItem(json_data_array, i);

                        if( json_item_array ) 
                        {

                        json_item = cJSON_GetObjectItem(json_item_array, "name" );

                            if(json_item) 
                            {

                                if(  0== strcmp("rptCurrA", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.Irms_A  = cJSON_GetNumberValue(json_item_value);   
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Irms_A=%d\n", pattr_obj->data.Irms_A );
#endif

                                        }
                                }
                                if(  0== strcmp("rptCurrB", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.Irms_B  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Irms_B=%d\n", pattr_obj->data.Irms_B );
#endif                                        
                                        }
                                }
                                if(  0== strcmp("rptCurrC", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.Irms_C  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Irms_C=%d\n", pattr_obj->data.Irms_C );
#endif  

                                        }
                                }

                                if(  0== strcmp("rptVoltA", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;
                                        pattr_obj->data.Urms_A  = cJSON_GetNumberValue(json_item_value);                                   
                                        
 #if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Urms_A=%d\n", pattr_obj->data.Urms_A );
#endif                                         

                                        }
                                }
                                if(  0== strcmp("rptVoltB", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1; 
                                        pattr_obj->data.Urms_B  = cJSON_GetNumberValue(json_item_value);                                   
                                        
 #if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Urms_B=%d\n", pattr_obj->data.Urms_B );
#endif                                         
                                        }
                                }
                                if(  0== strcmp("rptVoltrC", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1; 
                                        pattr_obj->data.Urms_C  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Urms_C=%d\n", pattr_obj->data.Urms_C );
#endif                                          
                                        }
                                }


                                if(  0== strcmp("rptVoltAb", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;
                                        pattr_obj->data.Uab  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Uab=%d\n", pattr_obj->data.Uab );
#endif                                          
                                        }
                                }
                                if(  0== strcmp("rptVoltBc", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1; 
                                        pattr_obj->data.Ubc  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Ubc=%d\n", pattr_obj->data.Ubc );
#endif  

                                        }
                                }
                                if(  0== strcmp("rptVoltCa", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1; 
                                        pattr_obj->data.Uca  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Uca=%d\n", pattr_obj->data.Uca );
#endif                                          
                                        }
                                }



                                if(  0== strcmp("rptActPwrA", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.Power_A  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Power_A=%d\n", pattr_obj->data.Power_A );
#endif                                          
                                        }
                                }
                                if(  0== strcmp("rptActPwrB", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.Power_B  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Power_B=%d\n", pattr_obj->data.Power_B );
#endif  

                                        }
                                }
                                if(  0== strcmp("rptActPwrC", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.Power_C  = cJSON_GetNumberValue(json_item_value);                                   
                                        
 #if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Power_C=%d\n", pattr_obj->data.Power_C );
#endif                                         
                                        }
                                }
                                if(  0== strcmp("rptActPwrT", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.Power_T  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Power_T=%d\n", pattr_obj->data.Power_T );
#endif  

                                        }
                                }



                                if(  0== strcmp("rptReactPwrA", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1; 
                                        pattr_obj->data.Qa  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Qa=%d\n", pattr_obj->data.Qa );
#endif  

                                        }
                                }
                                if(  0== strcmp("rptReactPwrB", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.Qb  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Qb=%d\n", pattr_obj->data.Qb );
#endif  

                                        }
                                }
                                if(  0== strcmp("rptReactPwrC", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.Qc  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Qc=%d\n", pattr_obj->data.Qc );
#endif  

                                        }
                                }

                                if(  0== strcmp("rptReactPwrT", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1; 
                                        pattr_obj->data.Qt  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Qt=%d\n", pattr_obj->data.Qt );
#endif  

                                        }
                                }


                                if(  0== strcmp("rptAppaPwrA", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1; 
                                        pattr_obj->data.Sa  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Sa=%d\n", pattr_obj->data.Sa );
#endif  

                                        }
                                }
                                if(  0== strcmp("rptAppaPwrB", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.Sb  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Sb=%d\n", pattr_obj->data.Sb );
#endif  

                                        }
                                }
                                if(  0== strcmp("rptAppaPwrC", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.Sc  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Sc=%d\n", pattr_obj->data.Sc );
#endif  

                                        }
                                }

                                if(  0== strcmp("rptAppaPwrT", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1; 
                                        pattr_obj->data.St  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("St=%d\n", pattr_obj->data.St );
#endif  

                                        }
                                }

// 040A	1034	rptPfT	总功率因数
// 040F	1039	rptPfA	A相功率因数
// 410	1040	rptPfB	B相功率因数
// 411	1041	rptPfC	C相功率因数

                                if(  0== strcmp("rptPfA", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.PF_A  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("PF_A=%d\n", pattr_obj->data.PF_A );
#endif  

                                        }
                                }
                                if(  0== strcmp("rptPfB", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.PF_B  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("PF_B=%d\n", pattr_obj->data.PF_B );
#endif  

                                        }
                                }
                                if(  0== strcmp("rptPfC", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.PF_C  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("PF_C=%d\n", pattr_obj->data.PF_C );
#endif  

                                        }
                                }
                                if(  0== strcmp("rptPfT", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.PF_T  = cJSON_GetNumberValue(json_item_value);                                   
                                       
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("PF_T=%d\n", pattr_obj->data.PF_T );
#endif  

                                        }
                                }

// 040B	1035	rptActEngiT	总有功电能
// 412	1042	rptActEngiA	A相有功电能
// 413	1043	rptActEngiB	B相有功电能
// 414	1044	rptActEngiC	C相有功电能

                                if(  0== strcmp("rptActEngiA", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.EnergyP_A  = cJSON_GetNumberValue(json_item_value);                                                                         
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                         log_debug("EnergyP_A=%d\n", pattr_obj->data.EnergyP_A );
#endif  

                                        }
                                }
                                if(  0== strcmp("rptActEngiB", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.EnergyP_B  = cJSON_GetNumberValue(json_item_value);                                                                           
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("EnergyP_B=%d\n", pattr_obj->data.EnergyP_B );
#endif  

                                        }
                                }
                                if(  0== strcmp("rptActEngiC", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.EnergyP_C  = cJSON_GetNumberValue(json_item_value);                                                                          
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("EnergyP_C=%d\n", pattr_obj->data.EnergyP_C );
#endif  

                                        }
                                }
                                if(  0== strcmp("rptActEngiT", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.EnergyP_T  = cJSON_GetNumberValue(json_item_value);                                                                         
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("EnergyP_T=%d\n", pattr_obj->data.EnergyP_T );
#endif  

                                        }
                                }

// 420	1056	rptReactEngiT	总无功电能
                                if(  0== strcmp("rptReactEngiT", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.EnergyQ_T  = cJSON_GetNumberValue(json_item_value);                                                                         
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("EnergyQ_T=%d\n", pattr_obj->data.EnergyQ_T );
#endif  

                                        }
                                }

// 407	1031	rptRestCurr	漏电电流
// 408	1032	rptFreq	频率
                                if(  0== strcmp("rptRestCurr", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.Ileak  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Ileak=%d\n", pattr_obj->data.Ileak );
#endif  
                                        }
                                }
                                if(  0== strcmp("rptFreq", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.Freq  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("Freq=%d\n", pattr_obj->data.Freq );
#endif                                          
                                    }
                                }


// 421	1057	di	DI
// 422	1058	do	DO
                                if(  0== strcmp("di", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.DI  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("DI=%d\n", pattr_obj->data.DI );
#endif  
                                        }
                                }
                                if(  0== strcmp("do", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.DO  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                       log_debug("DO=%d\n", pattr_obj->data.DO );
#endif  

                                        }
                                }


                                if(  0== strcmp("do1", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.do1  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                      log_debug("do1=%d\n", pattr_obj->config.do1);
#endif  

                                    }
                                }


                                if(  0== strcmp("do2", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.do2  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("do2=%d\n", pattr_obj->config.do2);
#endif  

                                        }
                                }



    ///-------交流电表物模型-v1.2--------------
       
                    if(  0== strcmp("rptAlm", cJSON_GetStringValue(json_item) ) )
                    {//为0表示相等
                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                        if(json_item_value) {
                            pattr_obj->flags.bit.online = 1;  //节点在线标志
                            pattr_obj->data.alarm.value  = cJSON_GetNumberValue(json_item_value);                                   
                            
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                           log_debug("rptAlm=%d\n", pattr_obj->data.alarm.value);
#endif  

                            }
                    }

    ///-------交流电表物模型-v1.2--------------
                    if(  0== strcmp("pulseConst", cJSON_GetStringValue(json_item) ) )
                    {//为0表示相等
                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                        if(json_item_value) {
                            pattr_obj->flags.bit.online = 1;  //节点在线标志
                            pattr_obj->config.pulseConst  = cJSON_GetNumberValue(json_item_value);                                   
                            
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                            log_debug("pulseConst=%d\n", pattr_obj->config.pulseConst);
#endif  

                            }
                    }



///---------------------------------------物模型更新到 <<交流电表物模型-v1.4>>--------------------------------

                                if(  0== strcmp("almEn", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.almEn.value  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("almEn=%d\n", pattr_obj->config.almEn.value );
#endif 

                                        }
                                }



                                if(  0== strcmp("thFreqHi", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.thFreqHi  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_ac_meter_log_enable                                                                       
                                        log_debug("thFreqHi=%d\n", pattr_obj->config.thFreqHi);
#endif
                                    }
                                }



                                if(  0== strcmp("thFreqLow", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.thFreqLow  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_ac_meter_log_enable                                                                       
                                        log_debug("thFreqLow=%d\n", pattr_obj->config.thFreqLow);
#endif
                                    }
                                }







                                if(  0== strcmp("thVoltHi", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.thVoltHi  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_ac_meter_log_enable                                                                       
                                        log_debug("thVoltHi=%d\n", pattr_obj->config.thVoltHi);
#endif
                                    }
                                }



                                if(  0== strcmp("thVoltLow", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.thVoltLow  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_ac_meter_log_enable                                                                       
                                        log_debug("thVoltLow=%d\n", pattr_obj->config.thVoltLow);
#endif
                                    }
                                }



                                if(  0== strcmp("thPowerHi", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.thPowerHi  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_ac_meter_log_enable                                                                       
                                        log_debug("thPowerHi=%d\n", pattr_obj->config.thPowerHi);
#endif
                                    }
                                }



                                if(  0== strcmp("thPowerLow", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.thPowerLow  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_ac_meter_log_enable                                                                       
                                        log_debug("thPowerLow=%d\n", pattr_obj->config.thPowerLow);
#endif
                                    }
                                }


                                if(  0== strcmp("thCurrHi", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.thCurrHi  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_ac_meter_log_enable                                                                       
                                        log_debug("thCurrHi=%d\n", pattr_obj->config.thCurrHi);
#endif
                                    }
                                }



                                if(  0== strcmp("thCurrLow", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.thCurrLow  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_ac_meter_log_enable                                                                       
                                        log_debug("thCurrLow=%d\n", pattr_obj->config.thCurrLow);
#endif
                                    }
                                }



                                //-----同步节点数据到 白名单--------
                                iot_set_device_online_state_with_index(idx,  pattr_obj->flags.bit.online ); 
                                ///----------同步节点在线标志到 白名单-----


                                if(  0== strcmp("PT", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.PT  = cJSON_GetNumberValue(json_item_value);  

#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("PT=%d\n", pattr_obj->config.PT );
#endif  

                                        }
                                }

                                if(  0== strcmp("CT", cJSON_GetStringValue(json_item) ) )  //"ct"----json协议定的大写
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.CT  = cJSON_GetNumberValue(json_item_value);                                                                         
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("CT=%d\n", pattr_obj->config.CT );
#endif  

                                        }
                                }




        // {"name":"verSw","lable":"软件版本","val":"12345","str":"1234","type":3},
        //{"name":"verHw","lable":"硬件版本","val":"999888777666555","str":"1234","type":3},
                                if(  0== strcmp("verSw", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.soft_ver,0,sizeof(pattr_obj->info.soft_ver) );
                                        strncpy(pattr_obj->info.soft_ver,json_item->valuestring,sizeof(pattr_obj->info.soft_ver) );  //cJSON_GetStringValue(json_item_value)
                                                                            
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("soft_ver=%s\n", pattr_obj->info.soft_ver );
#endif  


                                        }
                                }


        // {"name":"productModel","lable":"产品型号","val":"","str":"1234","type":3},
                                if(  0== strcmp("productModel", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.product_model,0,sizeof(pattr_obj->info.product_model) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.product_model) );  
                                                                              
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("productModel=%s\n", pattr_obj->info.product_model );
#endif  


                                    }
                                }



        //{"name":"productMsg","lable":"生产信息","val":"","str":"1234","type":3},

                                if(  0== strcmp("productMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.production_info,0,sizeof(pattr_obj->info.production_info) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.production_info) );  
                                        
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("production_info=%s\n", pattr_obj->info.production_info );
#endif  


                                        }
                                }


        // {"name":"verdorMsg","lable":"厂家信息","val":"","str":"1234","type":3},
                                if(  0== strcmp("verdorMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.manufacturer,0,sizeof(pattr_obj->info.manufacturer) );
                                        strncpy(pattr_obj->info.manufacturer,json_item->valuestring,sizeof(pattr_obj->info.manufacturer) );  
                                                                              
#if IOT_SENSOR_ac_meter_log_enable                                                                    
                                        log_debug("manufacturer=%s\n", pattr_obj->info.manufacturer );
#endif  


                                    }
                                }


                            }  ///-----if(json_item)   

                        }  // ---- if( json_item_array ) 
        
                    }  //---for---json_data_array_size

       } break ;



       case IOT_SENSOR_dc_meter:
       {

                dc_meter_attr_t*   pattr_obj=NULL; 

                pattr_obj = dc_meter_get_obj( idx) ; 

                if( NULL==pattr_obj)
                {
                    log_debug("dc_meter not found!\n");      
                    goto lable_end;        
                }else{    
                    log_debug("dc_meter get ok!\n");    
                }
            
            
                    if( offline_flag )
                    {
                       //"errCode":2}///??????
                        pattr_obj->flags.bit.online = 0;  //--节点离线了-----
                        log_debug("node offline\n" );
                        goto lable_end;   
                    }

                    ////-------保存设备名-----
                    // memset(pattr_obj->dev_name_str,0,sizeof(pattr_obj->dev_name_str) );
                    // strncpy(pattr_obj->dev_name_str,dev_name_str,sizeof(pattr_obj->dev_name_str) );//        


                    for(i = 0; i < json_data_array_size; i++)
                    {
                        json_item_array = cJSON_GetArrayItem(json_data_array, i);

                        if( json_item_array ) 
                        {

                        json_item = cJSON_GetObjectItem(json_item_array, "name" );

                            if(json_item) 
                            {
//040B	1035	rptActEngiT	总有功电能   ?????
// 423	1059	rptVoltDc	直流电压有效值
// 424	1060	rptCurrDc	直流电流有效值
// 425	1061	rptPwrDc	直流功率有效值
                                if(  0== strcmp("rptVoltDc", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.Urms  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_dc_meter_log_enable                                                                    
                                        log_debug("Urms=%d\n", pattr_obj->data.Urms );
#endif  


                                        }
                                }
                                if(  0== strcmp("rptCurrDc", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.Irms  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_dc_meter_log_enable                                                                    
                                        log_debug("Irms=%d\n", pattr_obj->data.Irms );
#endif 

                                        }
                                }

                                if(  0== strcmp("rptPwrDc", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.Power  = cJSON_GetNumberValue(json_item_value);                                   

#if IOT_SENSOR_dc_meter_log_enable                                                                    
                                        log_debug("Power=%d\n", pattr_obj->data.Power );
#endif 

                                        }
                                }

                                              ///??????
                                if(  0== strcmp("rptEngT", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.Energy  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_dc_meter_log_enable                                                                    
                                        log_debug("Energy=%d\n", pattr_obj->data.Energy );
#endif 

                                        }
                                }



                                if(  0== strcmp("rptRevEngT", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.InvEnergy  = cJSON_GetNumberValue(json_item_value);                                                                          
#if IOT_SENSOR_dc_meter_log_enable                                                                    
                                        log_debug("InvEnergy=%d\n", pattr_obj->data.InvEnergy );
#endif 

                                        }
                                }


                                if(  0== strcmp("engLastM1", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.LastEnergy[0]  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_dc_meter_log_enable                                                                    
                                        log_debug("LastEnergy[0]=%d\n", pattr_obj->data.LastEnergy[0] );
#endif 

                                        }
                                }


                                if(  0== strcmp("engLastM2", cJSON_GetStringValue(json_item) ) )
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.LastEnergy[1]  = cJSON_GetNumberValue(json_item_value);        
                                        }
                                }

                                if(  0== strcmp("engLastM3", cJSON_GetStringValue(json_item) ) )
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.LastEnergy[2]  = cJSON_GetNumberValue(json_item_value);        
                                        }
                                }

                                if(  0== strcmp("engLastM4", cJSON_GetStringValue(json_item) ) )
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.LastEnergy[3]  = cJSON_GetNumberValue(json_item_value);        
                                        }
                                }

                                if(  0== strcmp("engLastM5", cJSON_GetStringValue(json_item) ) )
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.LastEnergy[4]  = cJSON_GetNumberValue(json_item_value);        
                                        }
                                }

                                if(  0== strcmp("engLastM6", cJSON_GetStringValue(json_item) ) )
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.LastEnergy[5]  = cJSON_GetNumberValue(json_item_value);        
                                        }
                                }

                                if(  0== strcmp("engLastM7", cJSON_GetStringValue(json_item) ) )
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.LastEnergy[6]  = cJSON_GetNumberValue(json_item_value);        
                                        }
                                }

                                if(  0== strcmp("engLastM8", cJSON_GetStringValue(json_item) ) )
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.LastEnergy[7]  = cJSON_GetNumberValue(json_item_value);        
                                        }
                                }
                                if(  0== strcmp("engLastM9", cJSON_GetStringValue(json_item) ) )
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.LastEnergy[8]  = cJSON_GetNumberValue(json_item_value);        
                                        }
                                }

                                if(  0== strcmp("engLastM10", cJSON_GetStringValue(json_item) ) )
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.LastEnergy[9]  = cJSON_GetNumberValue(json_item_value);        
                                        }
                                }
                                if(  0== strcmp("engLastM11", cJSON_GetStringValue(json_item) ) )
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.LastEnergy[10]  = cJSON_GetNumberValue(json_item_value);        
                                        }
                                }

                                if(  0== strcmp("engLastM12", cJSON_GetStringValue(json_item) ) )
                                {
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  
                                        pattr_obj->data.LastEnergy[11]  = cJSON_GetNumberValue(json_item_value);        
                                        }
                                }


// 421	1057	di	DI
// 422	1058	do	DO
                                if(  0== strcmp("di", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.DI  = cJSON_GetNumberValue(json_item_value);      
#if IOT_SENSOR_dc_meter_log_enable                                                                     
                                        log_debug("DI=%d\n", pattr_obj->data.DI );
#endif
                                    }
                                }
                                if(  0== strcmp("do", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.DO  = cJSON_GetNumberValue(json_item_value);       
#if IOT_SENSOR_dc_meter_log_enable                                                                    
                                        log_debug("DO=%d\n", pattr_obj->data.DO );
#endif
                                    }
                                }



                                if(  0== strcmp("do1", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.do1  = cJSON_GetNumberValue(json_item_value);   
#if IOT_SENSOR_dc_meter_log_enable                                                                        
                                        log_debug("do1=%d\n", pattr_obj->config.do1);
#endif
                                    }
                                }


                                if(  0== strcmp("do2", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.do2  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_dc_meter_log_enable                                                                       
                                        log_debug("do2=%d\n", pattr_obj->config.do2);
#endif
                                    }
                                }


///---------------------------------------物模型更新到 <<直流电表物模型-v1.4>>--------------------------------
                    if(  0== strcmp("rptAlm", cJSON_GetStringValue(json_item) ) )
                    {//为0表示相等
                        json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                        if(json_item_value) {
                            pattr_obj->flags.bit.online = 1;  //节点在线标志
                            pattr_obj->data.rptAlm.value  = cJSON_GetNumberValue(json_item_value);                                   
                            
#if IOT_SENSOR_dc_meter_log_enable                                                                    
                           log_debug("rptAlm=%d\n", pattr_obj->data.rptAlm.value);
#endif  

                            }
                    }




///---------------------------------------物模型更新到 <<直流电表物模型-v1.4>>--------------------------------

                                if(  0== strcmp("almEn", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.almEn.value  = cJSON_GetNumberValue(json_item_value);                                   
                                        
#if IOT_SENSOR_dc_meter_log_enable                                                                    
                                        log_debug("almEn=%d\n", pattr_obj->config.almEn.value );
#endif 

                                        }
                                }



                                if(  0== strcmp("thVoltHi", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.thVoltHi  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_dc_meter_log_enable                                                                       
                                        log_debug("thVoltHi=%d\n", pattr_obj->config.thVoltHi);
#endif
                                    }
                                }



                                if(  0== strcmp("thVoltLow", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.thVoltLow  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_dc_meter_log_enable                                                                       
                                        log_debug("thVoltLow=%d\n", pattr_obj->config.thVoltLow);
#endif
                                    }
                                }



                                if(  0== strcmp("thPowerHi", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.thPowerHi  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_dc_meter_log_enable                                                                       
                                        log_debug("thPowerHi=%d\n", pattr_obj->config.thPowerHi);
#endif
                                    }
                                }



                                if(  0== strcmp("thPowerLow", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.thPowerLow  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_dc_meter_log_enable                                                                       
                                        log_debug("thPowerLow=%d\n", pattr_obj->config.thPowerLow);
#endif
                                    }
                                }


                                if(  0== strcmp("thCurrHi", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.thCurrHi  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_dc_meter_log_enable                                                                       
                                        log_debug("thCurrHi=%d\n", pattr_obj->config.thCurrHi);
#endif
                                    }
                                }



                                if(  0== strcmp("thCurrLow", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.thCurrLow  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_dc_meter_log_enable                                                                       
                                        log_debug("thCurrLow=%d\n", pattr_obj->config.thCurrLow);
#endif
                                    }
                                }





                                //-----同步节点数据到 白名单--------
                                iot_set_device_online_state_with_index(idx,  pattr_obj->flags.bit.online ); 
                                ///----------同步节点在线标志到 白名单-----

                                if(  0== strcmp("PT", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.PT  = cJSON_GetNumberValue(json_item_value);    
#if IOT_SENSOR_dc_meter_log_enable                                                                       
                                        log_debug("PT=%d\n", pattr_obj->config.PT );
#endif
                                    }
                                }

                                if(  0== strcmp("CT", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->config.CT  = cJSON_GetNumberValue(json_item_value);  
#if IOT_SENSOR_dc_meter_log_enable                                                                          
                                        log_debug("CT=%d\n", pattr_obj->config.CT );
#endif
                                    }
                                }


        // {"name":"verSw","lable":"软件版本","val":"12345","str":"1234","type":3},
        //{"name":"verHw","lable":"硬件版本","val":"999888777666555","str":"1234","type":3},
                                if(  0== strcmp("verSw", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.soft_ver,0,sizeof(pattr_obj->info.soft_ver) );
                                        strncpy(pattr_obj->info.soft_ver,json_item->valuestring,sizeof(pattr_obj->info.soft_ver) );  //cJSON_GetStringValue(json_item_value)
                                        
                                        log_debug("soft_ver=%s\n", pattr_obj->info.soft_ver );
                                        }
                                }


        // {"name":"productModel","lable":"产品型号","val":"","str":"1234","type":3},
                                if(  0== strcmp("productModel", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.product_model,0,sizeof(pattr_obj->info.product_model) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.product_model) );  
                                        
                                        log_debug("productModel=%s\n", pattr_obj->info.product_model );
                                        }
                                }



        //{"name":"productMsg","lable":"生产信息","val":"","str":"1234","type":3},

                                if(  0== strcmp("productMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.production_info,0,sizeof(pattr_obj->info.production_info) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.production_info) );  
                                        
                                        log_debug("production_info=%s\n", pattr_obj->info.production_info );
                                        }
                                }


        // {"name":"verdorMsg","lable":"厂家信息","val":"","str":"1234","type":3},
                                if(  0== strcmp("verdorMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.manufacturer,0,sizeof(pattr_obj->info.manufacturer) );
                                        strncpy(pattr_obj->info.manufacturer,json_item->valuestring,sizeof(pattr_obj->info.manufacturer) );  
                                        
                                        log_debug("manufacturer=%s\n", pattr_obj->info.manufacturer );
                                        }
                                }


                            }  ///-----if(json_item)   

                        }  // ---- if( json_item_array ) 
        
                    }  //---for---json_data_array_size

       } break ;




       case IOT_SENSOR_air_cond:
       {

                air_cond_attr_t*   pattr_obj=NULL; 
                pattr_obj = air_cond_get_obj( idx) ; 

                if( NULL==pattr_obj)
                {
                    log_debug("pattr_obj air_cond not found!\n");      
                    goto lable_end;        
                }else{    
                    log_debug("pattr_obj air_cond get ok!\n");    
                }
            
                    if( offline_flag )
                    {
                       //"errCode":2}///??????
                        pattr_obj->flags.bit.online = 0;  //--节点离线了-----                       
                        log_debug("node offline\n" );
                        goto lable_end;   
                    }

                    ////-------保存设备名-----
                    // memset(pattr_obj->dev_name_str,0,sizeof(pattr_obj->dev_name_str) );
                    // strncpy(pattr_obj->dev_name_str,dev_name_str,sizeof(pattr_obj->dev_name_str) );//        


                    for(i = 0; i < json_data_array_size; i++)
                    {
                        json_item_array = cJSON_GetArrayItem(json_data_array, i);

                        if( json_item_array ) 
                        {

                        json_item = cJSON_GetObjectItem(json_item_array, "name" );

                            if(json_item) 
                            {


		// int16_t	intT	;//	内置温度	RO	900	2304
		// int16_t	intH	;//	内置湿度	RO	901	2305
		// int16_t	extT	;//	外接温度	RO	902	2306
		// int16_t	extH	;//	外接湿度	RO	903	2307
		// int32_t	acCurr	;//	空调电流	RO	904	2308
		// int16_t	acStatus	;//	空调状态	RO	905	2309
		// int16_t	almStatus	;//	告警状态	RO	906	2310
		// int16_t	acCtrlStatus	;//	空调控制开关状态	RO	907	2311
		// int16_t	acCtrlMode	;//	空调控制模式	RO	908	2312
		// int16_t	acCtrlFanSpeed	;//	空调控制风速状态	RO	909	2313
		// int16_t	acSwingStatus	;//	空调控制摆风方式状态	RO	90A	2314
		// int16_t	acTempeStatus	;//	空调控制温度状态	RO	90B	2315

                                if(  0== strcmp("intT", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.intT  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond intT=%d\n", pattr_obj->data.intT );
#endif
                                        }

                                }

                                if(  0== strcmp("intH", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.intH  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond intH=%d\n", pattr_obj->data.intH );
#endif
                                        }

                                }

                                if(  0== strcmp("extT", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.extT  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond extT=%d\n", pattr_obj->data.extT );
#endif
                                        }

                                }

                                if(  0== strcmp("extH", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.extH  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond extH=%d\n", pattr_obj->data.extH );
#endif
                                        }

                                }
                                if(  0== strcmp("acCurr", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.acCurr  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond acCurr=%d\n", pattr_obj->data.acCurr );
#endif
                                        }

                                }

                                if(  0== strcmp("acStatus", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.acStatus  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond acStatus=%d\n", pattr_obj->data.acStatus );
#endif
                                        }

                                }
                                if(  0== strcmp("almStatus", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.almStatus  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond almStatus=%d\n", pattr_obj->data.almStatus );
#endif
                                        }

                                }

                                if(  0== strcmp("acCtrlStatus", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.acCtrlStatus  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond acCtrlStatus=%d\n", pattr_obj->data.acCtrlStatus );
#endif
                                        }

                                }
                                if(  0== strcmp("acCtrlMode", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.acCtrlMode  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond acCtrlMode=%d\n", pattr_obj->data.acCtrlMode );
#endif
                                        }

                                }

                                if(  0== strcmp("acCtrlFanSpeed", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.acCtrlFanSpeed  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond acCtrlFanSpeed=%d\n", pattr_obj->data.acCtrlFanSpeed );
#endif
                                        }

                                }
                                if(  0== strcmp("acSwingStatus", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.acSwingStatus  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond acSwingStatus=%d\n", pattr_obj->data.acSwingStatus );
#endif
                                        }

                                }

                                if(  0== strcmp("acTempeStatus", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.acTempeStatus  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond acTempeStatus=%d\n", pattr_obj->data.acTempeStatus );
#endif
                                        }

                                }

//--------------------------------------------------------------------RO----------------------------------------------------------------------

                                //-----同步节点数据到 白名单--------
                                iot_set_device_online_state_with_index(idx,  pattr_obj->flags.bit.online ); 
                                ///----------同步节点在线标志到 白名单-----



//--------------------------------------------------------------------RW----------------------------------------------------------------------


                                if(  0== strcmp("energySaveTempe", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.energySaveTempe  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond energySaveTempe=%d\n", pattr_obj->data.energySaveTempe );
#endif
                                        }

                                }

                                if(  0== strcmp("energySaveFanSpeed", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.energySaveFanSpeed  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond energySaveFanSpeed=%d\n", pattr_obj->data.energySaveFanSpeed );
#endif
                                        }

                                }

                                if(  0== strcmp("acStatusDetectMode", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.acStatusDetectMode  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond acStatusDetectMode=%d\n", pattr_obj->data.acStatusDetectMode );
#endif
                                        }

                                }

                                if(  0== strcmp("DO", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.DO  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond DO=%d\n", pattr_obj->data.DO );
#endif
                                        }

                                }


                                if(  0== strcmp("DI", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.DI  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond DI=%d\n", pattr_obj->data.DI );
#endif
                                        }

                                }

                                if(  0== strcmp("doFuncSel", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.doFuncSel  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond doFuncSel=%d\n", pattr_obj->data.doFuncSel );
#endif
                                        }

                                }

                                if(  0== strcmp("diFuncSel", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.diFuncSel  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond diFuncSel=%d\n", pattr_obj->data.diFuncSel );
#endif
                                        }

                                }

                                if(  0== strcmp("diCtrlSel", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.diCtrlSel  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond diCtrlSel=%d\n", pattr_obj->data.diCtrlSel );
#endif
                                        }

                                }



                                if(  0== strcmp("pwrOnAutoStart", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.pwrOnAutoStart  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond pwrOnAutoStart=%d\n", pattr_obj->data.pwrOnAutoStart );
#endif
                                        }

                                }

                                if(  0== strcmp("buzzerFunc", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.buzzerFunc  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond buzzerFunc=%d\n", pattr_obj->data.buzzerFunc );
#endif
                                        }

                                }

                                if(  0== strcmp("coolWarmMode", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.coolWarmMode  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond coolWarmMode=%d\n", pattr_obj->data.coolWarmMode );
#endif
                                        }

                                }

                                if(  0== strcmp("acStatusTH", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.acStatusTH  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond acStatusTH=%d\n", pattr_obj->data.acStatusTH );
#endif
                                        }

                                }


                                if(  0== strcmp("acPwrOnOffTime", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.acPwrOnOffTime  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond acPwrOnOffTime=%d\n", pattr_obj->data.acPwrOnOffTime );
#endif
                                        }

                                }

                                if(  0== strcmp("ctrlMode", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.ctrlMode  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond ctrlMode=%d\n", pattr_obj->data.ctrlMode );
#endif
                                        }

                                }



                                if(  0== strcmp("diCtrlMinPwrOnTime", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.diCtrlMinPwrOnTime  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond diCtrlMinPwrOnTime=%d\n", pattr_obj->data.diCtrlMinPwrOnTime );
#endif
                                        }

                                }

                                if(  0== strcmp("diCtrlMinTrigTime", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.diCtrlMinTrigTime  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond diCtrlMinTrigTime=%d\n", pattr_obj->data.diCtrlMinTrigTime );
#endif
                                        }

                                }

                                if(  0== strcmp("teHuAlmTime", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.teHuAlmTime  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond teHuAlmTime=%d\n", pattr_obj->data.teHuAlmTime );
#endif
                                        }

                                }                              

                                if(  0== strcmp("resetRecover", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.resetRecover  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond resetRecover=%d\n", pattr_obj->data.resetRecover );
#endif
                                        }

                                }

                                if(  0== strcmp("learnIr", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.learnIr  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond learnIr=%d\n", pattr_obj->data.learnIr );
#endif
                                        }

                                }

                                if(  0== strcmp("sendIr", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.sendIr  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond sendIr=%d\n", pattr_obj->data.sendIr );
#endif
                                        }

                                }
                                if(  0== strcmp("remoteCode", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.remoteCode  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond remoteCode=%d\n", pattr_obj->data.remoteCode );
#endif
                                        }

                                }
                                if(  0== strcmp("remoteCtrlKey", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {
                                        pattr_obj->config.remoteCtrlKey  = cJSON_GetNumberValue(json_item_value);     
#if IOT_SENSOR_air_cond_log_enable                                                                    
                                        log_debug("air_cond remoteCtrlKey=%d\n", pattr_obj->data.remoteCtrlKey );
#endif
                                        }

                                }

///-------vre.1.27------------------




///------------------------------------------------------------------------------------------------------------------------------------------


        // {"name":"verSw","lable":"软件版本","val":"12345","str":"1234","type":3},
        //{"name":"verHw","lable":"硬件版本","val":"999888777666555","str":"1234","type":3},
                                if(  0== strcmp("verSw", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.soft_ver,0,sizeof(pattr_obj->info.soft_ver) );
                                        strncpy(pattr_obj->info.soft_ver,json_item->valuestring,sizeof(pattr_obj->info.soft_ver) );  //cJSON_GetStringValue(json_item_value)
                                        
                                        log_debug("soft_ver=%s\n", pattr_obj->info.soft_ver );
                                        }
                                }


        // {"name":"productModel","lable":"产品型号","val":"","str":"1234","type":3},
                                if(  0== strcmp("productModel", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.product_model,0,sizeof(pattr_obj->info.product_model) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.product_model) );  
                                        
                                        log_debug("productModel=%s\n", pattr_obj->info.product_model );
                                        }
                                }



        //{"name":"productMsg","lable":"生产信息","val":"","str":"1234","type":3},

                                if(  0== strcmp("productMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.production_info,0,sizeof(pattr_obj->info.production_info) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.production_info) );  
                                        
                                        log_debug("production_info=%s\n", pattr_obj->info.production_info );
                                        }
                                }


        // {"name":"verdorMsg","lable":"厂家信息","val":"","str":"1234","type":3},
                                if(  0== strcmp("verdorMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.manufacturer,0,sizeof(pattr_obj->info.manufacturer) );
                                        strncpy(pattr_obj->info.manufacturer,json_item->valuestring,sizeof(pattr_obj->info.manufacturer) );  
                                        
                                        log_debug("manufacturer=%s\n", pattr_obj->info.manufacturer );
                                        }
                                }


                            }  ///-----if(json_item)   

                        }  // ---- if( json_item_array ) 
        
                    }  //---for---json_data_array_size

       } break ;




       case IOT_SENSOR_battery:
       {
            uint32_t iot_id ;
            int64_t  value ;

                battery_attr_t*   pattr_obj=NULL; 

                pattr_obj = battery_get_obj( idx) ; 

                if( NULL==pattr_obj)
                {
                    log_debug("pattr_obj not found!\n");      
                    goto lable_end;        
                }else{    
                    log_debug("pattr_obj get ok!\n");    
                }
            

                   if( offline_flag )
                    {
                       //"errCode":2}///??????
                        pattr_obj->flags.bit.online = 0;  //--节点离线了-----
                        log_debug("node offline\n" );
                        goto lable_end;   
                    }

                    ////-------保存设备名-----
                    // memset(pattr_obj->dev_name_str,0,sizeof(pattr_obj->dev_name_str) );
                    // strncpy(pattr_obj->dev_name_str,dev_name_str,sizeof(pattr_obj->dev_name_str) );//        


                    for(i = 0; i < json_data_array_size; i++)
                    {
                        json_item_array = cJSON_GetArrayItem(json_data_array, i);

                        if( json_item_array ) 
                        {

// {"head":{"gatewayId":"gw_0000C0A8011B","replaceId":"","msgId":3924,"timeStamp":1747895183,"response":"readAttr"},
// "data":{"nodeType":1,"channel":1,"privAddr":17,"mac":"FFFFFFFFFFFF","name":"sensor_ch1_addr17","pid":"d003","totalFrame":1,"currFrame":1,"totalAttr":6,"itemCnt":6},
// "attrLst":[{"name":"volt1","dpid":43521,"val":10694,"type":0},{"name":"res1","dpid":43900,"val":3000,"type":0},
// {"name":"battHealth11a","dpid":44300,"val":0,"type":0},{"name":"temp1","dpid":44700,"val":259,"type":0},
// {"name":"remainCap1n2a","dpid":45100,"val":0,"type":0},{"name":"firstCap1n2a","dpid":45300,"val":0,"type":0}]}


                        json_item = cJSON_GetObjectItem(json_item_array, "dpid" );

                            if(json_item) 
                            {
                                iot_id  = cJSON_GetNumberValue(json_item);  

                               if( ( 1u == curr_frame ) && (json_data_array_size< pb_65H_read_type_0_iot_id_MAX ) && \
                                   (iot_id>=battery_RO_run_param_of_node_iot_id_begin) && (iot_id<=battery_RO_run_param_of_node_iot_id_end) )  //  (43521U)~ (45449U) 
                                {
                                   json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                   
                                   if(json_item_value) 
                                   {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志

                                        value =  cJSON_GetNumberValue(json_item_value);     
                                        dev_module_65H_read_type_0_set( i,iot_id, value) ;                                  
#if  IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery iot_id=%d,value=%ld\n", iot_id, value);
#endif                                        
                                    }

                                   continue;
                                }

                            }

// battery iot_id=43521,value=10694
// battery iot_id=43900,value=3000
// battery iot_id=44300,value=0
// battery iot_id=44700,value=259
// battery iot_id=45100,value=0
// battery iot_id=45300,value=0


                        json_item = cJSON_GetObjectItem(json_item_array, "name" );

                            if(json_item) 
                            {

                                if( 0== strcmp("battAlmTotal", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.battAlmTotal  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery battAlmTotal=%d\n", pattr_obj->data.battAlmTotal );
#endif                                        
                                        }
                                }


                                if(  0== strcmp("groupVolt", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.groupVolt  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery groupVolt=%d\n", pattr_obj->data.groupVolt );
#endif                                        
                                        }
                                }


                                if(  0== strcmp("chargeCurrComp", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.chargeCurrComp  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery chargeCurrComp=%d\n", pattr_obj->data.chargeCurrComp );
#endif                                        
                                        }
                                } 


                                if(  0== strcmp("floatChargeCurr", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.floatChargeCurr  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery floatChargeCurr=%d\n", pattr_obj->data.floatChargeCurr );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("envTempe1", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.envTempe1  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery envTempe1=%d\n", pattr_obj->data.envTempe1 );
#endif                                        
                                        }
                                } 
                                if(  0== strcmp("envTempe2", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.envTempe2  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery envTempe2=%d\n", pattr_obj->data.envTempe2 );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("maxVoltBattNo", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.maxVoltBattNo  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery maxVoltBattNo=%d\n", pattr_obj->data.maxVoltBattNo );
#endif                                        
                                        }
                                } 
                                if(  0== strcmp("minVoltBattNo", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.minVoltBattNo  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery minVoltBattNo=%d\n", pattr_obj->data.minVoltBattNo );
#endif                                        
                                        }
                                }


                                if(  0== strcmp("maxResBattNo", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.maxResBattNo  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery maxResBattNo=%d\n", pattr_obj->data.maxResBattNo );
#endif                                        
                                        }
                                } 
                                if(  0== strcmp("averageDifference", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.averageDifference  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery averageDifference=%d\n", pattr_obj->data.averageDifference );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("poleDifference", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.poleDifference  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery poleDifference=%d\n", pattr_obj->data.poleDifference );
#endif                                        
                                        }
                                } 


                                if(  0== strcmp("minRestCap", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.minRestCap  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery minRestCap=%d\n", pattr_obj->data.minRestCap );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("minRestLoadTime", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.minRestLoadTime  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery minRestLoadTime=%d\n", pattr_obj->data.minRestLoadTime );
#endif                                        
                                        }
                                } 

                                if(  0== strcmp("restCap", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.restCap  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery restCap=%d\n", pattr_obj->data.restCap );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("restLoadTime", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.restLoadTime  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery restLoadTime=%d\n", pattr_obj->data.restLoadTime );
#endif                                        
                                        }
                                } 

                                if(  0== strcmp("chargeStatus", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.chargeStatus  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery chargeStatus=%d\n", pattr_obj->data.chargeStatus );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("groupAlm", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.groupAlm  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery groupAlm=%d\n", pattr_obj->data.groupAlm );
#endif                                        
                                        }
                                } 




  //--------蓄电池传感器物模型-v1.7-----------
 #if   dev_battery_iot_model_ver_1_7    
 

                                if(  0== strcmp("chargeCurr", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.chargeCurr  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery chargeCurr=%d\n", pattr_obj->data.chargeCurr );
#endif                                        
                                        }
                                } 


                                if(  0== strcmp("rippleWave", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.rippleWave  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery rippleWave=%d\n", pattr_obj->data.rippleWave );
#endif                                        
                                        }
                                }


                                if(  0== strcmp("hydrogenContent", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.hydrogenContent  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery hydrogenContent=%d\n", pattr_obj->data.hydrogenContent );
#endif                                        
                                        }
                                } 

                                if(  0== strcmp("extAlm", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.extAlm  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery extAlm=%d\n", pattr_obj->data.extAlm );
#endif                                        
                                        }
                                }


#endif  //--------蓄电池传感器物模型-v1.7-----------




//--------蓄电池传感器物模型-v1.3-----------
                                if(  0== strcmp("cellVoltMax", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.cellVoltMax  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery cellVoltMax=%d\n", pattr_obj->data.cellVoltMax );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("cellVoltMin", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.cellVoltMin  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery cellVoltMin=%d\n", pattr_obj->data.cellVoltMin );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("cellResMax", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.cellResMax  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery cellResMax=%d\n", pattr_obj->data.cellResMax );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("tempeCellMax", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.tempeCellMax  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery tempeCellMax=%d\n", pattr_obj->data.tempeCellMax );
#endif                                        
                                        }
                                }



   // uint16_t	battNum	;//	1127	4391	电池数量	RO			uint16_t
                                if(  0== strcmp("battNum", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.battNum  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery battNum=%d\n", pattr_obj->data.battNum );
#endif                                        
                                        }
                                }





                                //-----同步节点数据到 白名单--------
                                iot_set_device_online_state_with_index(idx, pattr_obj->flags.bit.online ); 
                                //----------同步节点在线标志到 白名单-----


				
 
    // uint16_t	comParam1	;//	1128	4392	com 电池串参数传感器映射参数1	R/W		配置参数	uint16_t
    // uint16_t	addr1	;//	1129	4393	addr1	R/W		配置参数	uint16_t
    // uint16_t	num1	;//	112A	4394	num1	R/W		配置参数	uint16_t
    // uint16_t	comParam2	;//	112B	4395	com 电池串参数传感器映射参数2	R/W		配置参数	uint16_t
    // uint16_t	addr2	;//	112C	4396	addr2	R/W		配置参数	uint16_t
    // uint16_t	num2	;//	112D	4397	num2	R/W		配置参数	uint16_t
    // uint16_t	battScurrparam	;//	112E	4398	com;      //电池串电流映射参数	R/W		配置参数	uint16_t
    // uint16_t	currAddr	;//	112F	4399	addr;	R/W		配置参数	uint16_t
    // uint16_t	currnum	;//	1130	4400	currnum;	R/W		配置参数	uint16_t
    // uint16_t	volcin	;//	1131	4401	volcom;   //电池串电压映射参数	R/W		配置参数	uint16_t
    // uint16_t	laddr	;//	1132	4402	laddr;	R/W		配置参数	uint16_t
    // uint16_t	lnum	;//	1133	4403	num;	R/W		配置参数	uint16_t


#if  (dev_battery_iot_model_ver_1_7 )
                                if(  0== strcmp("battType", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.battType  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery battType=%d\n", pattr_obj->data.battType );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("battModuleTupe", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.battModuleTupe  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery battModuleTupe=%d\n", pattr_obj->data.battModuleTupe );
#endif                                        
                                        }
                                }

 
                                if(  0== strcmp("battStdRes", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.battStdRes  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery battStdRes=%d\n", pattr_obj->data.battStdRes );
#endif                                        
                                        }
                                }

#endif

#if  (dev_battery_iot_model_ver_1_7 ||  dev_battery_iot_model_ver_1_8 )


                               if(  0== strcmp("battRateCap", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.battRateCap  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery battRateCap=%d\n", pattr_obj->config.battRateCap );
#endif                                        
                                        }
                                }




                                if(  0== strcmp("maxBattVolt", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.maxBattVolt  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery maxBattVolt=%d\n", pattr_obj->config.maxBattVolt );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("minBattVolt", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.minBattVolt  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery minBattVolt=%d\n", pattr_obj->config.minBattVolt );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("maxBattTempe", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.maxBattTempe  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery maxBattTempe=%d\n", pattr_obj->config.maxBattTempe );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("minBattTempe", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.minBattTempe  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery minBattTempe=%d\n", pattr_obj->config.minBattTempe );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("maxBattRes", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.maxBattRes  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery maxBattRes=%d\n", pattr_obj->config.maxBattRes );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("minBattRes", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.minBattRes  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery minBattRes=%d\n", pattr_obj->config.minBattRes );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("minBattCap", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.minBattCap  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery minBattCap=%d\n", pattr_obj->config.minBattCap );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("maxBattVoltDiff", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.maxBattVoltDiff  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery maxBattVoltDiff=%d\n", pattr_obj->config.maxBattVoltDiff );
#endif                                        
                                        }
                                }


                                if(  0== strcmp("maxDischargeCurr", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.maxDischargeCurr  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery maxDischargeCurr=%d\n", pattr_obj->config.maxDischargeCurr );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("dischargeCurrTh", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.dischargeCurrTh  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery dischargeCurrTh=%d\n", pattr_obj->config.dischargeCurrTh );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("maxChargeCurr", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.maxChargeCurr  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery maxChargeCurr=%d\n", pattr_obj->config.maxChargeCurr );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("minChargeCurr", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.minChargeCurr  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery minChargeCurr=%d\n", pattr_obj->config.minChargeCurr );
#endif                                        
                                        }
                                }


                                if(  0== strcmp("maxFloatChargeCurr", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.maxFloatChargeCurr  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery maxFloatChargeCurr=%d\n", pattr_obj->config.maxFloatChargeCurr );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("maxGroupVolt", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.maxGroupVolt  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery maxGroupVolt=%d\n", pattr_obj->config.maxGroupVolt );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("minGroupVolt", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.minGroupVolt  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery minGroupVolt=%d\n", pattr_obj->config.minGroupVolt );
#endif                                        
                                        }
                                }


#endif


#if  (dev_battery_iot_model_ver_1_7 )


                                if(  0== strcmp("maxRippleWave", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.maxRippleWave  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery maxRippleWave=%d\n", pattr_obj->config.maxRippleWave );
#endif                                        
                                        }
                                }




                                if(  0== strcmp("battResFactor", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.battResFactor  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery battResFactor=%d\n", pattr_obj->config.battResFactor );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("resChangeCtrl", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.resChangeCtrl  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery resChangeCtrl=%d\n", pattr_obj->config.resChangeCtrl );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("resChangeFactor", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.resChangeFactor  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery resChangeFactor=%d\n", pattr_obj->config.resChangeFactor );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("resOffset", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.resOffset  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery resOffset=%d\n", pattr_obj->config.resOffset );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("rateLoadCurrProportion", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.rateLoadCurrProportion  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery rateLoadCurrProportion=%d\n", pattr_obj->config.rateLoadCurrProportion );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("openCircuitFactro", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.openCircuitFactro  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery openCircuitFactro=%d\n", pattr_obj->config.openCircuitFactro );
#endif                                        
                                        }
                                }

#endif


#if  (dev_battery_iot_model_ver_1_7 || dev_battery_iot_model_ver_1_8 )


                                if(  0== strcmp("wrProtect", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.wrProtect  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery wrProtect=%d\n", pattr_obj->config.wrProtect );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("resetBattMDev", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.resetBattMDev  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery resetBattMDev=%d\n", pattr_obj->config.resetBattMDev );
#endif                                        
                                        }
                                }
                                if(  0== strcmp("wrSysCfg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.wrSysCfg  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery wrSysCfg=%d\n", pattr_obj->config.wrSysCfg );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("almCtrl", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.almCtrl  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery almCtrl=%d\n", pattr_obj->config.almCtrl );
#endif                                        
                                        }
                                }


#endif

#if  (dev_battery_iot_model_ver_1_7 )


                                if(  0== strcmp("stationType", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.stationType  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery stationType=%d\n", pattr_obj->config.stationType );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("battSerialNum", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.battSerialNum  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery battSerialNum=%d\n", pattr_obj->config.battSerialNum );
#endif                                        
                                        }
                                }



                                if(  0== strcmp("stdSampleInterval", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.stdSampleInterval  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery stdSampleInterval=%d\n", pattr_obj->config.stdSampleInterval );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("chargeSampleInterval", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.chargeSampleInterval  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery chargeSampleInterval=%d\n", pattr_obj->config.chargeSampleInterval );
#endif                                        
                                        }
                                }
                                if(  0== strcmp("voltSampleInterval", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.voltSampleInterval  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery voltSampleInterval=%d\n", pattr_obj->config.voltSampleInterval );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("balanceCtrl", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.balanceCtrl  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery balanceCtrl=%d\n", pattr_obj->config.balanceCtrl );
#endif                                        
                                        }
                                }
                                if(  0== strcmp("checkRes", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.checkRes  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery checkRes=%d\n", pattr_obj->config.checkRes );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("resetCfg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.resetCfg  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery resetCfg=%d\n", pattr_obj->config.resetCfg );
#endif                                        
                                        }
                                }


                                if(  0== strcmp("restoreCfg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.restoreCfg  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery restoreCfg=%d\n", pattr_obj->config.restoreCfg );
#endif                                        
                                        }
                                }

                                if(  0== strcmp("saveCfg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.saveCfg  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery saveCfg=%d\n", pattr_obj->config.saveCfg );
#endif                                        
                                        }
                                }
                                if(  0== strcmp("version", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
//                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->config.version  = cJSON_GetNumberValue(json_item_value);                                   
#if IOT_SENSOR_battery_log_enable                                                                    
                                        log_debug("battery version=%d\n", pattr_obj->config.version );
#endif                                        
                                        }
                                }

#endif

        // {"name":"verSw","lable":"软件版本","val":"12345","str":"1234","type":3},
        //{"name":"verHw","lable":"硬件版本","val":"999888777666555","str":"1234","type":3},
                                if(  0== strcmp("verSw", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.soft_ver,0,sizeof(pattr_obj->info.soft_ver) );
                                        strncpy(pattr_obj->info.soft_ver,json_item->valuestring,sizeof(pattr_obj->info.soft_ver) );  //cJSON_GetStringValue(json_item_value)
                                        
                                        log_debug("soft_ver=%s\n", pattr_obj->info.soft_ver );
                                        }
                                }


        // {"name":"productModel","lable":"产品型号","val":"","str":"1234","type":3},
                                if(  0== strcmp("productModel", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.product_model,0,sizeof(pattr_obj->info.product_model) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.product_model) );  
                                        
                                        log_debug("productModel=%s\n", pattr_obj->info.product_model );
                                        }
                                }



        //{"name":"productMsg","lable":"生产信息","val":"","str":"1234","type":3},

                                if(  0== strcmp("productMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.production_info,0,sizeof(pattr_obj->info.production_info) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.production_info) );  
                                        
                                        log_debug("production_info=%s\n", pattr_obj->info.production_info );
                                        }
                                }


        // {"name":"verdorMsg","lable":"厂家信息","val":"","str":"1234","type":3},
                                if(  0== strcmp("verdorMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.manufacturer,0,sizeof(pattr_obj->info.manufacturer) );
                                        strncpy(pattr_obj->info.manufacturer,json_item->valuestring,sizeof(pattr_obj->info.manufacturer) );  
                                        
                                        log_debug("manufacturer=%s\n", pattr_obj->info.manufacturer );
                                        }
                                }


                            }  ///-----if(json_item)   

                        }  // ---- if( json_item_array ) 
        
                    }  //---for---json_data_array_size

       } break ;




//#if 0
       case IOT_SENSOR_generator:   // oil engine 
       {

                generator_attr_t*   pattr_obj=NULL; 

                pattr_obj = generator_get_obj( idx) ; 

                if( NULL==pattr_obj)
                {
                    log_debug("generator not found!\n");      
                    goto lable_end;        
                }else{    
                    log_debug("generator get ok!\n");    
                }
            
            
                    if( offline_flag )
                    {
                       //"errCode":2}///??????
                        pattr_obj->flags.bit.online = 0;  //--节点离线了-----
                        log_debug("node offline\n" );
                        goto lable_end;   
                    }



                    for(i = 0; i < json_data_array_size; i++)
                    {
                        json_item_array = cJSON_GetArrayItem(json_data_array, i);

                        if( json_item_array ) 
                        {

                        json_item = cJSON_GetObjectItem(json_item_array, "name" );

                            if(json_item) 
                            {

                                if( 0== strcmp("genVolt", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.genVolt  = cJSON_GetNumberValue(json_item_value);                                   

#if IOT_SENSOR_generator_log_enable                                                                    
                                        log_debug("genVolt=%d\n", pattr_obj->data.genVolt );
#endif 

                                        }
                                }


                                if( 0== strcmp("genCurr", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.genCurr  = cJSON_GetNumberValue(json_item_value);                                   

#if IOT_SENSOR_generator_log_enable                                                                    
                                        log_debug("genCurr=%d\n", pattr_obj->data.genCurr );
#endif 

                                        }
                                }


                                if( 0== strcmp("genPwr", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.genPwr  = cJSON_GetNumberValue(json_item_value);                                   

#if IOT_SENSOR_generator_log_enable                                                                    
                                        log_debug("genPwr=%d\n", pattr_obj->data.genPwr );
#endif 

                                        }
                                }

                                if( 0== strcmp("genSpeed", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.genSpeed  = cJSON_GetNumberValue(json_item_value);                                   

#if IOT_SENSOR_generator_log_enable                                                                    
                                        log_debug("genSpeed=%d\n", pattr_obj->data.genSpeed );
#endif 

                                        }
                                }


                                if( 0== strcmp("genTorque", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.genTorque  = cJSON_GetNumberValue(json_item_value);                                   

#if IOT_SENSOR_generator_log_enable                                                                    
                                        log_debug("genTorque=%d\n", pattr_obj->data.genTorque );
#endif 

                                        }
                                }


                                if( 0== strcmp("runTime", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.runTime  = cJSON_GetNumberValue(json_item_value);                                   

#if IOT_SENSOR_generator_log_enable                                                                    
                                        log_debug("runTime=%d\n", pattr_obj->data.runTime );
#endif 

                                        }
                                }

                                if( 0== strcmp("fuelUsed", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.fuelUsed  = cJSON_GetNumberValue(json_item_value);                                   

#if IOT_SENSOR_generator_log_enable                                                                    
                                        log_debug("fuelUsed=%d\n", pattr_obj->data.fuelUsed );
#endif 

                                        }
                                }


                                if( 0== strcmp("oilTempe", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.oilTempe  = cJSON_GetNumberValue(json_item_value);                                   

#if IOT_SENSOR_generator_log_enable                                                                    
                                        log_debug("oilTempe=%d\n", pattr_obj->data.oilTempe );
#endif 

                                        }
                                }


                                if( 0== strcmp("oilLevel", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.oilLevel  = cJSON_GetNumberValue(json_item_value);                                   

#if IOT_SENSOR_generator_log_enable                                                                    
                                        log_debug("oilLevel=%d\n", pattr_obj->data.oilLevel );
#endif 

                                        }
                                }



                                if( 0== strcmp("alarm", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.alarm  = cJSON_GetNumberValue(json_item_value);                                   

#if IOT_SENSOR_generator_log_enable                                                                    
                                        log_debug("alarm=%d\n", pattr_obj->data.alarm );
#endif 

                                        }
                                }




                                if( 0== strcmp("engiOpState", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.engiOpState  = cJSON_GetNumberValue(json_item_value);                                   

#if IOT_SENSOR_generator_log_enable                                                                    
                                        log_debug("engiOpState=%d\n", pattr_obj->data.engiOpState );
#endif 

                                        }
                                }





                                if( 0== strcmp("systemStatus", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等
                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );
                                    if(json_item_value) {
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                        pattr_obj->data.systemStatus  = cJSON_GetNumberValue(json_item_value);                                   

#if IOT_SENSOR_generator_log_enable                                                                    
                                        log_debug("systemStatus=%d\n", pattr_obj->data.systemStatus );
#endif 

                                        }
                                }



                                //-----同步节点数据到 白名单--------
                                iot_set_device_online_state_with_index(idx,  pattr_obj->flags.bit.online ); 
                                ///----------同步节点在线标志到 白名单-----


                               //配置参数----R/W-----可读写-------

                                if(  0== strcmp("thOilLevelLow", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        pattr_obj->config.thOilLevelLow  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                     
#if IOT_SENSOR_generator_log_enable                                                                    
                                       log_debug("thOilLevelLow=%d\n", pattr_obj->config.thOilLevelLow );
#endif 
                                        }

                                }


                                if(  0== strcmp("thOilTLow", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        pattr_obj->config.thOilTLow  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                     
#if IOT_SENSOR_generator_log_enable                                                                    
                                       log_debug("thOilTLow=%d\n", pattr_obj->config.thOilTLow );
#endif 
                                        }

                                }



                                if(  0== strcmp("thOilTHi", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        pattr_obj->config.thOilTHi  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                     
#if IOT_SENSOR_generator_log_enable                                                                    
                                       log_debug("thOilTHi=%d\n", pattr_obj->config.thOilTHi );
#endif 
                                        }

                                }






                                 //配置参数----WO------只写不可读------- 

                                if(  0== strcmp("setMode", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        pattr_obj->config.setMode  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                     
#if IOT_SENSOR_generator_log_enable                                                                    
                                       log_debug("setMode=%d\n", pattr_obj->config.setMode );
#endif 
                                        }

                                }


                                if(  0== strcmp("manualStart", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        pattr_obj->config.manualStart  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                     
#if IOT_SENSOR_generator_log_enable                                                                    
                                       log_debug("manualStart=%d\n", pattr_obj->config.manualStart );
#endif 
                                        }

                                }


                                if(  0== strcmp("autoStartCfg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        pattr_obj->config.autoStartCfg  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                     
#if IOT_SENSOR_generator_log_enable                                                                    
                                       log_debug("autoStartCfg=%d\n", pattr_obj->config.autoStartCfg );
#endif 
                                        }

                                }


                                if(  0== strcmp("almMute", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        pattr_obj->config.almMute  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                     
#if IOT_SENSOR_generator_log_enable                                                                    
                                       log_debug("almMute=%d\n", pattr_obj->config.almMute );
#endif 
                                        }

                                }


                                if(  0== strcmp("almReset", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        pattr_obj->config.almReset  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                     
#if IOT_SENSOR_generator_log_enable                                                                    
                                       log_debug("almReset=%d\n", pattr_obj->config.almReset );
#endif 
                                        }

                                }


                                if(  0== strcmp("genSwOn", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        pattr_obj->config.genSwOn  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                     
#if IOT_SENSOR_generator_log_enable                                                                    
                                       log_debug("genSwOn=%d\n", pattr_obj->config.genSwOn );
#endif 
                                        }

                                }


                                if(  0== strcmp("mainsSwOn", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        pattr_obj->config.mainsSwOn  = cJSON_GetNumberValue(json_item_value);   //0.01  
                                        pattr_obj->flags.bit.online = 1;  //节点在线标志
                                     
#if IOT_SENSOR_generator_log_enable                                                                    
                                       log_debug("mainsSwOn=%d\n", pattr_obj->config.mainsSwOn );
#endif 
                                        }

                                }





        // {"name":"verSw","lable":"软件版本","val":"12345","str":"1234","type":3},
        //{"name":"verHw","lable":"硬件版本","val":"999888777666555","str":"1234","type":3},
                                if(  0== strcmp("verSw", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.soft_ver,0,sizeof(pattr_obj->info.soft_ver) );
                                        strncpy(pattr_obj->info.soft_ver,json_item->valuestring,sizeof(pattr_obj->info.soft_ver) );  //cJSON_GetStringValue(json_item_value)
                                        
                                        log_debug("soft_ver=%s\n", pattr_obj->info.soft_ver );
                                        }
                                }


        // {"name":"productModel","lable":"产品型号","val":"","str":"1234","type":3},
                                if(  0== strcmp("productModel", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.product_model,0,sizeof(pattr_obj->info.product_model) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.product_model) );  
                                        
                                        log_debug("productModel=%s\n", pattr_obj->info.product_model );
                                        }
                                }



        //{"name":"productMsg","lable":"生产信息","val":"","str":"1234","type":3},

                                if(  0== strcmp("productMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.production_info,0,sizeof(pattr_obj->info.production_info) );
                                        strncpy(pattr_obj->info.product_model,json_item->valuestring,sizeof(pattr_obj->info.production_info) );  
                                        
                                        log_debug("production_info=%s\n", pattr_obj->info.production_info );
                                        }
                                }


        // {"name":"verdorMsg","lable":"厂家信息","val":"","str":"1234","type":3},
                                if(  0== strcmp("verdorMsg", cJSON_GetStringValue(json_item) ) )
                                {//为0表示相等

                                    json_item_value = cJSON_GetObjectItem(json_item_array, "val" );

                                    if(json_item_value) {

                                        memset(pattr_obj->info.manufacturer,0,sizeof(pattr_obj->info.manufacturer) );
                                        strncpy(pattr_obj->info.manufacturer,json_item->valuestring,sizeof(pattr_obj->info.manufacturer) );  
                                        
                                        log_debug("manufacturer=%s\n", pattr_obj->info.manufacturer );
                                        }
                                }


                            }  ///-----if(json_item)   

                        }  // ---- if( json_item_array ) 
        
                    }  //---for---json_data_array_size

       } break ;  ///case---case IOT_SENSOR_engine:   // oil engine -

//#endif 

      default:
      break;

    } ///-------swtich------------


// //-----同步节点数据到 白名单--------
 //  iot_set_device_online_state_with_index(idx,  pliq_in->flags.bit.online );   ////同步节点在线标志到 白名单-----

 //-----还有其它数据需要同步到 白名单----通道编号--通道地址???----


lable_end:

    log_debug("%s() end\n",__FUNCTION__);


	if (json) {
		cJSON_Delete(json);	//清除结构体
	}	

   json = NULL;  

}




// Tcp_Tx_ch=1, local_ktj_js
// {"head":{"gatewayId":"gw_CC0500CFB180","msgId":53,"cmd":"setAttr"},
// "data":{"deviceName":"io_1_19","mac":"FFFFFFFFFFFF","nodeType":1,"channel":1,"privAddr":24},"attrLst":[{"dpid":16,"val":1}]}
// iotv30  socket send done
// 16:54:21- ETH_1 local_ktj_js Rx: len=228
// {"head":{"gatewayId":"gw_CC0500CFB180","replaceId":"","msgId":53,"timeStamp":1741856061,"response":"setAttr"},
// "data":{"pid":"4002","mac":"FFFFFFFFFFFF","nodeType":1,"channel":1,"privAddr":24,"deviceName":"io_1_19"},"errCode":0}




//  写属性  setAttr  接收应答解析
void json_writeback_setAttr(const char *pstr, const void *param)
{
	cJSON *json = NULL;
//	cJSON *json_head = NULL;
	cJSON *json_item = NULL;
	cJSON *json_data = NULL;

    dev_mod_info_t   dev_mod_info;

    uint8_t idx;
 
    uint8_t offline_flag=0;  //离线标记

    int32_t err_code=0; //
    
    ////发送应答到服务器
    tlv_ack_e ack_code =0;


 #define   DEV_NAME_STR_LEN      (32u)   
    char dev_name_str[DEV_NAME_STR_LEN];

    log_debug("%s() start\n",__FUNCTION__);

	json = cJSON_Parse(pstr);
	if (json == NULL) { // not json string
		return ;
	}

 
   memset( (uint8_t*)&dev_mod_info,0,sizeof(dev_mod_info_t ) );

// {"head":{"gatewayId":"gw_CC0500CFB180","replaceId":"","msgId":53,"timeStamp":1741856061,"response":"setAttr"},
// "data":{"pid":"4002","mac":"FFFFFFFFFFFF","nodeType":1,"channel":1,"privAddr":24,"deviceName":"io_1_19"},"errCode":0}

    unsigned int msg_id = get_input_msgId(json);


	json_data = cJSON_GetObjectItem(json, "data");

	if(json_data) {
        
		json_item = cJSON_GetObjectItem(json_data, "channel" );
		if(json_item) {
            dev_mod_info.channel =   cJSON_GetNumberValue(json_item);                                       
            log_debug("channel=%d\n", dev_mod_info.channel );
            
		}

		json_item = cJSON_GetObjectItem(json_data, "privAddr" );
		if(json_item) {
            dev_mod_info.chan_addr =   cJSON_GetNumberValue(json_item);                                       
            log_debug("chan_addr=%d\n", dev_mod_info.chan_addr );
		}

		json_item = cJSON_GetObjectItem(json_data, "nodeType" );
		if(json_item) {
            dev_mod_info.node_type =   cJSON_GetNumberValue(json_item);                                       
            log_debug("node_type=%d\n", dev_mod_info.node_type );
		}

		json_item = cJSON_GetObjectItem(json_data, "deviceName" );
		if(json_item) {
            log_debug("deviceName=%s\n", cJSON_GetStringValue(json_item) );      
              memset(dev_name_str,0,sizeof(dev_name_str) );
              strncpy(dev_name_str,json_item->valuestring,sizeof(dev_name_str) );//          
		}


		json_item = cJSON_GetObjectItem(json_data, "pid" );
		if(json_item) {
              log_debug("pid=%s\n", cJSON_GetStringValue(json_item) );      
		}
	
	}


    // dev_mod_info.node_type  = IOT_SENSOR_liquid; //车工的节点类型为1.与物模型对应不上---这里手动更改为 IOT_SENSOR_liquid

//返回 0=查找失败， !0= 查找成功
    if( iot_find_node_index_with_info( &dev_mod_info, &idx ) ) 
    {
       dev_mod_info.node_type = iot_get_node_type_with_index(idx);
       iot_set_device_name_with_index( idx, dev_name_str); //保存设备名字
    }else{
        log_debug("channel=%d, chan_addr=%d, not found\n", dev_mod_info.channel, dev_mod_info.chan_addr );   
        goto label_end;        
    }


 //       ,"errCode":0}
        ////"errCode":2}
   
		json_item = cJSON_GetObjectItem(json, "errCode" );
		if(json_item) {
            err_code =   cJSON_GetNumberValue(json_item);                                       
            log_debug("errCode=%d\n", err_code);

             switch (err_code) {
                case 0:
                {
                    ack_code =tlv_ack_ok;
                    offline_flag = 0;//--节点在线-----
                } break;

                case 2:
                {
                    ack_code =tlv_ack_subdev_error;
                    offline_flag = 1;//--节点离线了-----
                    //-----同步节点数据到 白名单--------
                    iot_set_device_online_state_with_index(idx, 0); //pattr_obj->flags.bit.online 
                    //----------同步节点在线标志到 白名单-----       
                } break;

                default:
                {
                    ack_code =tlv_ack_invalid;
                }break;
             
             }
		}
  
    log_debug("ack_code=%d,node offline_flag=%d\n",ack_code,offline_flag );

// 0x65://读子设备属性
// 0x66://写子设备属性

	if(msg_id>=0) {
        proto_pb_global_ack( tlv_cmd_node_write_attr, msg_id, ack_code );
        log_debug("pb global_ack msg_id=%d\n",msg_id );
    }else{
        log_debug("msg_id=%d error\n",msg_id );
    }


label_end:

    log_debug("%s() end\n",__FUNCTION__);


	if (json) {
		cJSON_Delete(json);	//清除结构体
	}	

   json = NULL;  

}


















void json_writeback_del_white_list(const char *pstr, const void *param)
{

    
}


//  写白名单 接收应答解析
void json_writeback_setwhite_list(const char *pstr, const void *param)
{
	cJSON *json = NULL;
//	cJSON *json_head = NULL;
	cJSON *json_item = NULL;
	cJSON *json_data = NULL;

    dev_mod_info_t   dev_mod_info;

    uint8_t idx;
 
    uint8_t offline_flag=0;  //离线标记

    int32_t err_code=0; //
    
    ////发送应答到服务器
    tlv_ack_e ack_code =0;


 #define   DEV_NAME_STR_LEN      (32u)   
    char dev_name_str[DEV_NAME_STR_LEN];

    log_debug("%s() start\n",__FUNCTION__);

	json = cJSON_Parse(pstr);
	if (json == NULL) { // not json string
		return ;
	}

 
   memset( (uint8_t*)&dev_mod_info,0,sizeof(dev_mod_info_t ) );

// {"head":{"gatewayId":"gw_CC0500CFB180","replaceId":"","msgId":53,"timeStamp":1741856061,"response":"setAttr"},
// "data":{"pid":"4002","mac":"FFFFFFFFFFFF","nodeType":1,"channel":1,"privAddr":24,"deviceName":"io_1_19"},"errCode":0}

    unsigned int msg_id = get_input_msgId(json);


	json_data = cJSON_GetObjectItem(json, "data");

	if(json_data) {
        
		json_item = cJSON_GetObjectItem(json_data, "channel" );
		if(json_item) {
            dev_mod_info.channel =   cJSON_GetNumberValue(json_item);                                       
            log_debug("channel=%d\n", dev_mod_info.channel );
            
		}

		json_item = cJSON_GetObjectItem(json_data, "privAddr" );
		if(json_item) {
            dev_mod_info.chan_addr =   cJSON_GetNumberValue(json_item);                                       
            log_debug("chan_addr=%d\n", dev_mod_info.chan_addr );
		}

		json_item = cJSON_GetObjectItem(json_data, "nodeType" );
		if(json_item) {
            dev_mod_info.node_type =   cJSON_GetNumberValue(json_item);                                       
            log_debug("node_type=%d\n", dev_mod_info.node_type );
		}

		json_item = cJSON_GetObjectItem(json_data, "deviceName" );
		if(json_item) {
            log_debug("deviceName=%s\n", cJSON_GetStringValue(json_item) );      
              memset(dev_name_str,0,sizeof(dev_name_str) );
              strncpy(dev_name_str,json_item->valuestring,sizeof(dev_name_str) );//          
		}


		json_item = cJSON_GetObjectItem(json_data, "pid" );
		if(json_item) {
              log_debug("pid=%s\n", cJSON_GetStringValue(json_item) );      
		}
	
	}


    // dev_mod_info.node_type  = IOT_SENSOR_liquid; //车工的节点类型为1.与物模型对应不上---这里手动更改为 IOT_SENSOR_liquid

//返回 0=查找失败， !0= 查找成功
    if( iot_find_node_index_with_info( &dev_mod_info, &idx ) ) 
    {
       dev_mod_info.node_type = iot_get_node_type_with_index(idx);
       iot_set_device_name_with_index( idx, dev_name_str); //保存设备名字
    }else{
        log_debug("channel=%d, chan_addr=%d, not found\n", dev_mod_info.channel, dev_mod_info.chan_addr );   
        goto label_end;        
    }


 //       ,"errCode":0}
        ////"errCode":2}
   
		json_item = cJSON_GetObjectItem(json, "errCode" );
		if(json_item) {
            err_code =   cJSON_GetNumberValue(json_item);                                       
            log_debug("errCode=%d\n", err_code);

             switch (err_code) {
                case 0:
                {
                    ack_code =tlv_ack_ok;
                    offline_flag = 0;//--节点在线-----
                } break;

                case 2:
                {
                    ack_code =tlv_ack_subdev_error;
                    offline_flag = 1;//--节点离线了-----
                    //-----同步节点数据到 白名单--------
                    iot_set_device_online_state_with_index(idx, 0); //pattr_obj->flags.bit.online 
                    //----------同步节点在线标志到 白名单-----       
                } break;

                default:
                {
                    ack_code =tlv_ack_invalid;
                }break;
             
             }
		}
  
    log_debug("ack_code=%d,node offline_flag=%d\n",ack_code,offline_flag );

// 0x65://读子设备属性
// 0x66://写子设备属性

	if(msg_id>=0) {
        proto_pb_global_ack( tlv_cmd_node_write_attr, msg_id, ack_code );
        log_debug("pb global_ack msg_id=%d\n",msg_id );
    }else{
        log_debug("msg_id=%d error\n",msg_id );
    }


label_end:

    log_debug("%s() end\n",__FUNCTION__);


	if (json) {
		cJSON_Delete(json);	//清除结构体
	}	

   json = NULL;  

}

